欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

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

程序员文章站 2022-05-28 21:53:41
...

在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 下 Mysql 安装后使用时提示 var lib mysql mysql.sock' 2 的解决