启动MysqL 报错:
ERROR 2002 (HY000): Can’t connect to local MysqL server through socket ‘/var/lib/MysqL/MysqL.sock’ (111)
1、先查看 /etc/rc.d/init.d/MysqLd status 看看m y s q l 是否已经启动.
另外看看是不是权限问题.
2、确定你的MysqL.sock是不是在那个位置,
MysqL -u 你的MysqL用户名 -p -S /var/lib/MysqL/MysqL.sock
3、试试:service MysqLd start
4、如果是权限问题,则先改变权限 #chown -R MysqL:MysqL /var/lib/MysqL
[root@localhost ~]# /etc/init.d/MysqLd start
启动 MysqL: [ 确定 ]
[root@localhost ~]# MysqL -uroot -p
ERROR 2002 (HY000): Can't connect to local MysqL server through socket '/var/lib/MysqL/MysqL.sock' (111)
原因是,/var/lib/MysqL 的访问权限问题。
shell> chown -R MysqL:MysqL /var/lib/MysqL
接着启动服务器
shell> /etc/init.d/MysqL start
服务器正常启动后察看 /var/lib/MysqL 自动生成MysqL.sock文件。
但是我的问题仍然没有得到解决。
问题终于解决:
方法: 修改/etc/my.conf:
[MysqLd]
datadir=/usr/local/MysqL/data
socket=/var/lib/MysqL/MysqL.sock
[MysqL.server]
user=MysqL
basedir=/usr/local/MysqL
If there is not currently a section called [client],add one at the bottom of the file and copy the socket= line under the [MysqLd] section such as:
[client]
socket=/var/lib/MysqL/MysqL.sock
发现依旧如此,运行/etc/init.d/MysqL start报错: Starting MysqLCouldn't find MysqL manager or server
是MysqLd服务没启,运行/usr/local/MysqL/bin/MysqLd_safe &
问题解决。