LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) (https://www.linuxquestions.org/questions/linux-software-2/cant-connect-to-local-mysql-server-through-socket-tmp-mysql-sock-2-a-495181/)

cygnus-x1 10-24-2006 02:00 PM

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 2.6.8.1
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.

Any ideas?

thanks

Doug

lucazorzi 10-25-2006 06:56 AM

Quote:

Ok so now I start up and I get this error:
Do you mean that you start up MySQL? If not you can start it doing mysqld --user=[MYSQL-USER-NAME] as root.

imagined 06-05-2008 01:14 PM

Looks like you have another MySQL installation you didn't get rid of completely.

Here is a command about how to fix it:
http://www.coderemix.com/tutorials/c...l-MySQL-server


All times are GMT -5. The time now is 08:25 PM.