700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > mysql socket错误处理_解决Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’错误...

mysql socket错误处理_解决Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’错误...

时间:2018-09-13 15:44:06

相关推荐

mysql socket错误处理_解决Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’错误...

晚上清理mysql日志,强制重启了下mysql,然后mysql就登陆不上了。。。

以下方法来自网络,可以使用,已试。

刚安装完mysql,进行运行测试,报Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’错误,

[root@localhost mysql]# /usr/local/mysql/bin/mysqld_safe

131206 22:42:51 mysqld_safe Logging to ‘/var/log/mysqld.log’.

131206 22:42:51 mysqld_safe Starting mysqld daemon with databases from /data/mysql/data

131206 22:42:57 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

[root@localhost mysql]# /usr/local/mysql/bin/mysql

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)

检查一下mysql的运行状态

[root@localhost mysql]# ps -ef | grep mysql

root 32092 2108 0 22:43 pts/0 00:00:00 grep mysql

查看/tmp文件夹的确没有mysql.sock文件,

通过find命令查找

[root@localhost /]# find / -name mysql.sock

/var/lib/mysql/mysql.sock

原来安装到/var/lib/mysql/mysql.sock这个位置啦,我们需要修改f文件

[root@localhost /]# vi /usr/local/mysql/f

[client]

character-set-server = utf8

port = 3306

socket = /var/lib/mysql/mysql.sock

……

保存之后即出,重新启动mysql。

---

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。