Getting mysql.sock error

This error comes up because, if you give 'localhost' as the host, mysql client library will try to use the unix domain socket (file based) instead of the TCP one. And every mysql client library has one path to the Unix domain socket.

  • In Monyog's mysql client library it is:  '/var/lib/mysql/mysql.sock'
  • In  "phpMyAdmin", it is:  '/var/run/mysqld/mysqld.sock'

So if one software works the other breaks. To solve this problem:

  1. You can create a symbolic link to your original  '/var/run/mysqld/mysqld.sock'  in '/var/lib/mysql/mysql.sock'
    '/var/lib/mysql/mysql.sock'     ->     '/var/run/mysqld/mysqld.sock'


    The command to create this is:  

    ln -s /var/run/mysqld/mysqld.sock /var/lib/mysql/mysql.sock 

    This will create a symbolic link  '/var/lib/mysql/mysql.sock' to  '/var/run/mysqld/mysqld.sock'. So both the applications will work.

  2. You can keep '/var/run/mysqld/mysqld.sock' as it is. And you can force Monyog to use TCP based connection specifying "" as the host instead of 'localhost'.

Still need help? Contact Us Contact Us