问题:
[root@master ~]# /etc/init.d/mysqld restart
停止 mysqld: [确定]
Another MySQL daemon already running with the same unix socket.
正在启动 mysqld: [失败]
[root@master ~]#
问题分析:
由于主机意外关机,导致mysql无法启动,原因是mysql服务启动后会在/var/lib/mysql下生成一个mysql.sock文件,由于意外关机该文件没有删除,导致mysql服务启动后无法再创建mysql.sock文件。
解决办法1:
[root@master ~]# mv /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock_bak
[root@master ~]# service mysqld restart
停止 mysqld: [确定]
正在启动 mysqld: [确定]
[root@master ~]#
解决办法2:
在mysql服务启动前判断/var/lib/mysql下是否存在mysql.sock这个文件,如果存在就将其删除:
[root@master ~]# vi /etc/rc.sysinit
# Check and delete mysql.sock
if [ -x /var/lib/mysql/mysql.sock ]; then
rm -f /var/lib/mysql/mysql.sock
fi
****************************************************************************************