Apache connection to MySQL

This is my first attempt to build and deploy a web app . I have a remote Linux server running Apache and MySQL and can connect consistently from my local computer across the Internet to the database on the MySQL server. When I ‘run’ the application from the Xojo IDE on my development computer there’s no problem connecting to the remote server database.

Once I build and migrate the application to the server and then run the application on the server, I get an error message generated by my application saying it can’t connect to the db. Apache can see and start the application but fails when attempting to connect.

I changed to MyDatabase.Host = “localhost” from the domain name I used when running the application from the IDE before building and deploying.

Apache is running properly on the server as is MySQL. I can start and stop each from the command line. MySQL Workbench run on the Linux server can access the database.

It feels like a permissions issue but I don’t know where to look for the problem. Its just Apache that can’t see the db.

This is the error shown in a window asking if I want to send the error:
Unhandled IOException
Message:

Stack:
TextOutputStream.!Create%o%o
App.AppendToDBErrorLog%%os
JobTracDatabase.!SetupNewDatabase%o%
Session.Session.Event_Open%%o<Session.Session>
WebSession._ExecuteEvent%%osA1v&b
WebSession._HandleEvent%%oso<HTTPServer.HTTPRequestContext>
WebSession._HandleRequest%i4%oso<HTTPServer.HTTPRequestContext>
WebApplication.HandleHTTPRequest%%oo<HTTPServer.HTTPRequestContext>
HTTPServer.HTTPRequestThread.Event_Run%%o<HTTPServer.HTTPRequestThread>

Please help this newbie…

Thanks,

Doron

Are you checking the Db Error and ErrorMessage properties? Maybe they would shed some more light on things?

Give 775 access on the folder that your application is running. Your app cannot create log file.

Thank you for replying. Yes, I have a log file in place and the entry is:
05/05/2014 11:46 AM JobTrac database could not be found.
05/05/2014 11:46 AM unable to open database file

To elaborate further, since this continues to baffle me, I have the following error checking code in the SetupNewDatabase shared method:
if not MyDatabase.Connect then
msg = “JobTrac database could not be found.”
#If TargetDesktop Then
MsgBox(msg)
#ElseIf TargetWeb Then
MsgBox “Couldn’t connect to MySQL server…”
App.AppendToDBErrorLog(msg)
#EndIf
Return Nil
Else
//MsgBox “Successfully connected to MySQL database…”
Return MyDatabase
end if

I built the application as Stand Alone. The DBErrorLog file does show the msg and a MsgBox displays according to the #ElseIf TargetWeb directive. Permissions are set properly on the folder containing the application and the error log file is receiving the admonishment that the connection can’t be made to the MySQL server.

MySQL Workbench running on the server can see the database with all the possibilities of MyDatabase.Host I’ve thrown at the application. I’ve made sure that the mysql server and the apache2 server are running properly.

I’m stumped…

what is the actual error message coming from the driver when it can’t connect…db.errormessage

Check the db permissions for localhost access

Try changing MyDatabase.Host back to the public Nat’d IP or hostname you were using from your PC.

Thank you guys. I feel like we’re getting closer. The db.errormessage is:
Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)

my /etc/mysql/my.cnf file shows:
socket = /var/run/mysqld/mysqld.sock

I, obviously, don’t understand the what points mysql to the /tmp/mysql.sock…

SOLVED! Thank you for your help…

linked /tmp/mysql.sock to /var/run/mysqld/mysqld.sock with:

ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock