当前位置:Gxlcms > mysql > Linux下Mysql安装后使用时提示varlibmysqlmysql.sock'2的解决

Linux下Mysql安装后使用时提示varlibmysqlmysql.sock'2的解决

时间:2021-07-01 10:21:17 帮助过:44人阅读

在Linux上把mysql 重新安装了一下,安装好了后怎么也启动不了,出现提示 can#39;t connect to local mysql server through socket #39; v

在Linux上把mysql 重新安装了一下,安装好了后怎么也启动不了,,出现提示 can't connect to local mysql server through socket ' var lib mysql mysql.sock' 2的错误,网上找了一下,解决的方法到是不少,可试了以后都不行。操作后又出现 couldn't find manager or server错误。继续google,看了一个解决方法,于是就试了一下,还真的行了。

记下来:

[root@server ~]# /etc/init.d/mysql start

Starting MySQL..Couldn't find MySQL manager or server

or this error may display in WHM:

Can't connect to local mysql through socket /var/lib/mysql/mysql.sock

Apparently some RPM packages install this file with an incorrect path in the my.cnf file by default, leaving the service unable to start on its own. To fix, simply open /etc/my.cnf in vi and comment out the 'basedir=/var/lib' line like so:

#basedir=/var/lib

Save the file, and restart MySQL (/etc/init.d/mysql restart).

linux

人气教程排行