[root@110 db]# systemctl status mysql ● mysqld.service - LSB: start and stop MySQL Loaded: loaded (/etc/rc.d/init.d/mysqld; bad; vendor preset: disabled) Active: failed (Result: exit-code) since 五 2019-08-09 04:54:08 CST; 11s ago Docs: man:systemd-sysv-generator(8) Process: 7851 ExecStop=/etc/rc.d/init.d/mysqld stop (code=exited, status=0/SUCCESS) Process: 8751 ExecStart=/etc/rc.d/init.d/mysqld start (code=exited, status=1/FAILURE) CGroup: /system.slice/mysqld.service ├─7092 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/db/data --pid-file=/db/data/110.pid └─7269 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/db/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/db/data/110.pid --... 8月 09 04:54:06 110 systemd[1]: Starting LSB: start and stop MySQL... 8月 09 04:54:08 110 mysqld[8751]: Starting MySQL.. ERROR! The server quit without updating PID file (/db/data/110.pid). 8月 09 04:54:08 110 systemd[1]: mysqld.service: control process exited, code=exited status=1 8月 09 04:54:08 110 systemd[1]: Failed to start LSB: start and stop MySQL. 8月 09 04:54:08 110 systemd[1]: Unit mysqld.service entered failed state. 8月 09 04:54:08 110 systemd[1]: mysqld.service failed.
遇到了以上无法启动的问题,查看了以下mysql的进程,发现进程还在
kill一下试试
[root@110 db]# ps -ef | grep mysql root 7092 1 0 03:31 ? 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/db/data --pid-file=/db/data/110.pid mysql 7269 7092 0 03:31 ? 00:00:01 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/db/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/db/data/110.pid --socket=/tmp/mysqld.sock root 9131 7654 0 05:00 pts/0 00:00:00 grep --color=auto mysql
[root@110 db]# kill -9 7092 [root@110 db]# [root@110 db]# ps -ef | grep mysql mysql 7269 1 0 03:31 ? 00:00:01 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/db/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/db/data/110.pid --socket=/tmp/mysqld.sock root 9133 7654 0 05:00 pts/0 00:00:00 grep --color=auto mysql
再次查看,发现还有,继续kill
[root@110 db]# kill -9 7269 [root@110 db]# ps -ef | grep mysql root 9149 7654 0 05:01 pts/0 00:00:00 grep --color=auto mysql [root@110 db]#
没有了,启动mysql试一下
[root@110 db]# systemctl start mysql [root@110 db]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 2 Server version: 5.7.27 Source distribution Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. mysql>
登陆成功!