启动MySQL出现如下错误
May 21 20:37:58 localhost mysqld: Starting MySQL... ERROR! The server quit without updating PID file (/home/mysql-5.6.43/data/localhost.localdomain.pid). May 21 20:37:58 localhost systemd: mysqld.service: control process exited, code=exited status=1 May 21 20:37:58 localhost systemd: Failed to start LSB: start and stop MySQL. May 21 20:37:58 localhost systemd: Unit mysqld.service entered failed state. May 21 20:37:58 localhost systemd: mysqld.service failed.
试了网上很多解决办法都不行
MySQL版本:mysql-5.6.43
切换到MySQL data dir(MySQL的数据文件目录下)
获取MySQL用户运行的MySQL进程的pid,然后导入到localhost.localdomain.pid文件里面
# echo `ps aux | grep mysql | grep "user=mysql" | grep -v "grep" | awk '{print $2}'`>> redhat.pid
# mv redhat.pid localhost.localdomain.pid
# chown mysql:mysql localhost.localdomain.pid
重启MySQL
# systemctl restart mysqld
问题已经解决,MySQL启动成功
参考博客:
MySQL下PID文件丢失的相关错误的解决方法
http://www.imooc.com/article/265437
MySQL配置文件my.cnf的理解
https://www.cnblogs.com/langdashu/p/5889352.html