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?mysql

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

mysql -u root -psocket

orthis

mysql -u root -pPasswordrest

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

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

sudo service mysql start

orip

/etc/init.d/mysql start

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

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

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

 备注:百度很久出来的答案简直呵呵呵,重复率极高,必应搜到的答案,解决了个人问题

相关文章
相关标签/搜索