简体   繁体   中英

mysql connection error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) Godaddy Cpanel

My website was working fine till yesterday. But it suddenly started showing this error:

mysql connection error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

I don't think I made any changes except adding the site to alexa. I googled this and found a lot of resources but all those couldnt help me because I did not fully understand them. I am also not able to locate the file mysql.sock .

I want to know if my website has been hacked. Plus, the solution to the problem.

Might want to start with checking all your db configuration and make sure you did not overwrite or accidentally changed something?

If not that, then try restarting your mysql server. Not sure what Linux env your running, but whichever one it is, Google how to restart mysql.

You could also try and restarting apache. I think the command for that is

sudo service apache2 reload

sudo service apache2 restart

sudo service mysql restart

Then verify if mysql is running on the socket, run this command to see the process

ps aux | grep mysql

this is simple. Run this on commandline

mysql -uroot -p -hlocalhost
sudo service mysql restart
mysql -u root -p

I hope that works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM