一部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
本文转simmy51CTO博客,原文链接:http://blog.51cto.com/helpdesk/759405,如需转载请自行联系原作者