解决“ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111)”

1. 问题描述
ubuntu14.10下, 在终端进入mysql的控制台时出现以下信息:
 
  
$ mysql -uroot -p
Enter password: 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111)
 
2. 解决方法
进入/tmp/下, 删除mysql.sock, 再重启启动mysql服务即可, 操作如下:
 
  
$ cd /tmp/
$ ls
可以看到有mysql.sock和mysql.sock.lock两个文件, 将其删除即可
 
  
$ sudo rm mysql.sock mysql.sock.lock
再重启mysql服务:
 
  
$ cd /usr/local/mysql/
$ sudo ./support-files/mysql.server start
 
 
 
OK, Enjoy it!!!

你可能感兴趣的:(Linux,数据库)