Home / Linux / CPANEL/WHM: SITES DISPLAYING “CAN’T CONNECT TO LOCAL MYSQL SERVER THROUGH SOCKET ‘/VAR/TMP/MYSQL.SOCK’”

CPANEL/WHM: SITES DISPLAYING “CAN’T CONNECT TO LOCAL MYSQL SERVER THROUGH SOCKET ‘/VAR/TMP/MYSQL.SOCK’”

if you host a cPanel/whm web-server you may at some point have reports that client sites are displaying a message similar to: “Can’t connect to local MySQL server through socket ‘/var/tmp/mysql.sock’”

Here are a few quick steps to resolve the error if the location of your mysql.sock file is incorrect. This can occur after an automatic upgrade or similar scenario.

Check cPanel’s reference to mysql.sock file:

  1. Log onto WHM, go to the PHP editor -> Advanced mode and search for “mysql.default_socket”. 
  2. Check the value in “mysql.default_socket” matches a cPanel writable and secure location. 
  3. SSH to your server and use “locate mysql.sock” to see where the sock file is. Ensure your “mysql.default_socket” field matches the location.
    Note: Two likely locations for this are:
              /tmp/mysql.sock
    /var/lib/mysql/mysql.sock
  4. You may need to restart mySQL afterwards.

About Abdul Aziz

Biographical Info

Check Also

Footer disclaimers In Outgoing Mails WHM/Cpanel

Footer disclaimers In Outgoing Mails WHM/Cpanel 1. Download Altermime from http://www.pldaniels.com/altermime/altermime-0.3.9.tar.gz to your server, for …

Leave a Reply

Your email address will not be published. Required fields are marked *