mysql 異常Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock 解決辦法


Have you ever faced an error 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock', while trying to log in to MySQL as any user?

You can login to your MySQL via the following terminal command.

mysql -u root -p

or

mysql -u root -pPassword

Its recommended, not to use passwords in terminal command, due to privacy reasons.

Verify that, your MySQL is running. If not, start service by typing following command in your Linux terminal.

sudo service mysql start

or

/etc/init.d/mysql start

This error occurs due to multiple installations of MySQL, in the operating system.

To resolve the issue, run the following commands in your Linux terminal.

ps -A|grep mysql

Kill the process by using following command:

sudo pkill mysql

and then run command:

ps -A|grep mysqld

Also Kill this process by running the following command:

sudo pkill mysqld

Now you are fully set and can restart your MySQL server by running the following commands:

sudo service mysql restart
mysql -u root -p

 備注:百度好久出來的答案簡直呵呵呵,重復率極高,必應搜到的答案,解決了我的問題


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM