Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Received this while trying to access a MySQL database within a PHP page
Slackware 10.1 kernel 22.214.171.124
mysql 5.0.26 (installed as binary) shared client modules built from source and installed seperately
apache 2.2.0 (built and installed from source. been working fine)
php 5.1.6 (built from source a while ago however it initially built with an old libmysqlclient at version 4.0.x. So I built it again using the new client libraries
I ran into the familiar password problem with an old mysql client and a new mysql database. I was confused becuase many posts mention it was a PHP 4.x problem. I had PHP 5.1.6. Once I realized that my PHP was compiled with an old mysqlclient library I decided to try and fix my install base instead of resetting the passowords in mysql with OLD_PASSWORD (which I had done before on another machine a long time ago). I did not want to do that this time.
I tried to recomplie my php using the binary install of mysql 5.0.26 but it did not seem to want to pickup the static libmysqlclient.a. I kept getting all sorts of configure errors.
So I decided to start from scratch (sort of) I downloaded mysql 5.0.26 source and only built the client libraries and installed them in /usr/local/mysql2
Then I rebuilt php 5.1.6 --with-mysql=/usr/local/mysql2.
All went well. I installed them in apache and checked with ldd to make sure the libphp.5 was built with libmysqlclient.15.so and it was WOO HOO!
Ok so now I start up and I get this error:
Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /usr/local/apache-2.2.0/htdocs/vegadns-0.9.10/src/connect.php on line 28
If i go on the command line and log in with the same username and credentials it works.
I am running apache as user apache.
Last edited by cygnus-x1; 10-24-2006 at 03:09 PM.