Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock’

时间:2020-12-29 08:04:56
今天服务器遇到了一个很熟悉的问题
输入
#mysql -u root -p

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

在网上寻找了些答案,方面下面方法可行
 
 1.#ps -A|grep mysql
   显示类似:
  1829 ?        00:00:00 mysqld_safe
   1876 ?        00:00:31 mysqld
  2.#kill -9 1829
  3.#kill -9 1876
  4.#/etc/init.d/mysql restart
  5.#mysql -u root -p
OK,成功解决了!