Forum Moderators: coopster
At my offic, we just bought a new server that had MySQL and PHP pre-installed.
I know MySQL works. From the command line, I am able to set up users, create databases, create tables etc.
I know PHP works. I have a few test scripts written, and it works just fine.
Problem? WHen I try to connect to MySQL via mysql_connect(), I get the dreaded:
Warning: mysql_connect(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
I have verified that MySQL is running on socket 3306, but I am unsure as to '/tmp/mysql.sock'. I cannot find this file using the locate command at the command prompt. Even if I did find it, could I simply move the .sock to the /tmp/ directory? Or would I need to point MySQL to the location of the .sock? And if I do need to point to .sock, how does one go about doing this? .... Or ... Am I barking up the wrong tree/Do I need to be looking somewhere else for my problem?
I have read about 20 installation manuals, and non of them cover any troubleshooting tips, so I don't know where to start. Looking for some pointers toward the right path!
Any help is appreciated!
-- Zak
I went used that site you posted to give me some troubleshooting leverage. I had to create a my.cnf file in the directoy /etc/ and set the socket to /tmp/mysql.sock. Now I beleive that PHP is able to connect, however, now I have another problem that I am not really sure what it means... any ideas?
Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client
I really do appreciate the help!
-- Zak
If I had to guess, you probably can "fix" it by starting mysqld with --old-passwords enabled.
I shelled the following
mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('newpwd')
-> WHERE Host = 'some_host' AND User = 'some_user';
mysql> FLUSH PRIVILEGES;
And my mysql_connect() now works!
Thanks again for getting me started!
-- Zak