Your Webhosting Questions
Answered by the Webhosting Experts

What should I do, if I receive the following error while refreshing mysql on the server ?

Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)

Refer the below steps to solve this:

a.Check the ownership of “/var/lib/mysql” and its files and subdirectories in mysql user of mysql group.

To reset the ownership run the following command:

cd /var/lib/mysql
chown mysql.mysql -R /var/lib/mysql/*

b. Check the permissions of mysql directory, and all its files and subdirectories.

It must be set to rwxr-xr-x (755).

To reset the permission Run the following command:

chmod 755 -R /var/lib/mysql/*

C.Refresh mysql service now using the below command :-

service mysql start

The error message should disappear and you should see the below output :-

Starting MySQL. [ OK ]

Need More Personalized Help?

If you have any further issues, questions, or would like some assistance checking on this or anything else, please reach out to us from your account and provide your server credentials within the encrypted field for the best possible security and support.

If you are unable to reach your account or if you are on the go, please reach out from your valid account email to us here at: We are also available to you through our phone and live chat system 24/7/365.