SQL Problems

Craig White plug-discuss@lists.plug.phoenix.az.us
22 Mar 2002 05:00:42 -0700


On Thu, 2002-03-21 at 22:25, A.P. Etc wrote:
> I have mysql installed and running what appears to be fine. I created a
> database, added a table to it with no problems. I also have php up and
> running on my apache server, I did a quick "hello world" as a test. In spite
> of all this, it appears to have a problem connecting to the database.
> 
> It uses this code in the PHP tags:
> 
> $db = mysql_connect("localhost", "root");
> mysql_select_db("test",$db);
> 
> And I'm getting this error in my browser:
> 
> Warning: Can't connect to local MySQL server through socket
> '/var/tmp/mysql.sock' (111) in /usr/local/apache/htdocs/phptest.php on line
> 24
> Warning: MySQL Connection Failed: Can't connect to local MySQL server
> through socket '/var/tmp/mysql.sock' (111) in
> /usr/local/apache/htdocs/phptest.php on line 24
> 
> Does anyone have an ideas on what is wrong? I've taken a glance through the
> apache modules, and nothing appears to be missing. Can anyone help me figure
> out what I have overlooked?
> 
----
You haven't overlooked anything - it's just that mysql and php are a bit
out of sync. You can fix that by editing your php.ini file and finding
the line...

mysql.default_socket    =

and changing it to...

mysql.default_socket    =       /var/lib/mysql/mysql.sock

or wherever your mysql.sock is

Craig