mysql无法启动排查

付费节点推荐


免费节点


节点使用教程


环境:LNMP

无法启动mysql,错误如下:mysql很多错误都会报以下提示。

[root@izt4nc8yxlrlzg24150rzgz ~]# sudo mysql restart
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mys ql.sock' (2)
[root@izt4nc8yxlrlzg24150rzgz ~]# service mysql status
MySQL is not running, but lock file (/var/lock/subsys/mysql[FAILED]
[root@izt4nc8yxlrlzg24150rzgz ~]# service mysql start
Starting MySQL...The server quit without updating PID file (/usr/local/mysql/var /izt4nc8yxlrlzg24150rzgz.pid).

排查方法:

1)查看mysql错误日志,几乎所有的错误都能在日志中查看并解决。

cd /user/local/mysql/var

找到 .err 的文件,tail查看错误日志的末尾错误信息

[root@izt4nc8yxlrlzg24150rzgz var]# tail izt4nc8yxlrlzg24150rzgz.err
191213 1:20:17 [Note] - '0.0.0.0' resolves to '0.0.0.0';
191213 1:20:17 [Note] Server socket created on IP: '0.0.0.0'.
191213 1:20:17 [ERROR] Can't start server: Bind on TCP/IP port: Address already in use
191213 1:20:17 [ERROR] Do you already have another mysqld server running on por t: 3306 ?
191213 1:20:17 [ERROR] Aborting

191213 1:20:17 InnoDB: Starting shutdown...
191213 1:20:18 InnoDB: Shutdown completed; log sequence number 3569116046
191213 1:20:18 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

发现原因是端口被占用

2)找到 3306 端口被哪个进程占用

[root@izt4nc8yxlrlzg24150rzgz var]# netstat -tnlp | grep :3306
tcp6 0 0 :::3306 :::* LISTEN 20668/python

3)结束掉该进程

kill 20668

4)重启mysql服务

service mysql restart

未经允许不得转载:Bcoder资源网 » mysql无法启动排查

相关推荐

赞 (1)
分享到:更多 ()

评论 0

评论前必须登录!

登陆 注册