View Single Post
  #10  
Old 26th March 2013, 16:53
researcher7 researcher7 is offline
Junior Member
 
Join Date: Mar 2013
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OK, at this point, we have established that mysql is running, but the client cannot connect to it.

Few things to check.

Does /tmp/mysql.sock exist?

To find out run:

Code:
ls -1lah /tmp/mysql.sock
If you see an error message, then for some reason, the file was removed.

Run,

Code:
touch /tmp/mysql.sock
Restart mysql

Code:
service mysql restart
try connecting again.

If you still get the same error message, then we need to verify that the socket file location specified in your /etc/my.cnf (depending on your configuration, that file may also exist at /etc/mysql/my.cnf) is the same for both the service and the client.

Code:
nano /etc/my.cnf
Or
nano /etc/mysql/my.cnf
Check [mysqld] section.

You should find
Code:
socket      = /tmp/mysqld.sock
Check the [client] section, make sure the same exists.

If not, change according.

The general rule is the client section to match what the [mysqld] section has for the socket file location, so if it is
/tmp/mysqld.sock, then client section should have /tmp/mysqld.sock
If it is something else, like /var/run/mysqld/mysqld.sock then client should have the same.

Ctrl + o and then Enter to save.
Ctrl + x to exist nano.

If you have made any changes, restart mysql, and try again.

Last edited by researcher7; 26th March 2013 at 16:58.
Reply With Quote