一次MySQL无法启动故障的解决案例

一部Linux服务器重启之后发现MySQL无法启动,输入

~% mysql

提示: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'

用命令查看SQL服务 /etc/rc.d/init.d/mysqld status

提示:~% /etc/rc.d/init.d/mysqld status
mysqld is stopped

尝试启动服务:

/opt/lampp/bin/mysql.server start
Starting MySQL. ERROR! The server quit without updating PID file (/opt/lampp/var/mysql

然后我尝试将my.cnf更名,重启mysql服务,以为会重新生成一个my.cnf文件,却发现mysql还是无法启动。然后检查发现文件/var/lib/mysql/mysql.sock不存在,搜索了整个硬盘都没发现。重启系统也无效。

用命令查询SQL log:sudo cat /var/log/mysqld.log

提示:

Can't start server: Bind on TCP/IP port: Address already in use.

Do you already have another mysqld server running on port: 3306 ?

Google后用这个方法解决:

命令:mysqld_safe & 成功启动mysql服务
然后登陆:mysql –u root

 

你可能感兴趣的:(mysql,解决,案例,无法启动,故障)