紧急请教: mysql 无法正常启动 /usr/sbin/mysqld: Shutdown complete

2018-11-27 15:14:21 +08:00
 kmdd33

原因:由于忘记及时续费一个站点,DO 设置成了 suspended 状态,续费后,DO power on 然而发现 mysql 状态是关闭的,然后我尝试启动失败。

环境:openresty+php+mysql

正常的:openresty 和 php-fpm 都是 active 状态

非正常的:执行 systemctl status mysql

● mysqld.service - MySQL Community Server Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled) Active: failed (Result: start-limit) since Tue 2018-11-27 06:40:18 UTC; 9min ago Process: 2266 ExecStartPost=/usr/bin/mysql-systemd-start post (code=exited, status=0/SUCCESS) Process: 2265 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=203/EXEC) Process: 2250 ExecStartPre=/usr/bin/mysql-systemd-start pre (code=exited, status=0/SUCCESS) Main PID: 2265 (code=exited, status=203/EXEC)

Nov 27 06:40:18 systemd[1]: Failed to start MySQL Community Server. Nov 27 06:40:18 systemd[1]: Unit mysqld.service entered failed state. Nov 27 06:40:18 systemd[1]: mysqld.service failed. Nov 27 06:40:18 systemd[1]: mysqld.service holdoff time over, scheduling restart. Nov 27 06:40:18 systemd[1]: start request repeated too quickly for mysqld.service Nov 27 06:40:18 systemd[1]: Failed to start MySQL Community Server. Nov 27 06:40:18 systemd[1]: Unit mysqld.service entered failed state. Nov 27 06:40:18 systemd[1]: mysqld.service failed.

排查过程:

ls -ld /var/lib/mysql/

drwxr-xr-x 5 mysql mysql 268 Nov 27 06:27 /var/lib/mysql/

ls -lh /var/lib/mysql/

total 29M -rw-rw---- 1 mysql mysql 16K Apr 13 2018 aria_log.00000001

-rw-rw---- 1 mysql mysql 52 Apr 13 2018 aria_log_control

-rw-rw---- 1 mysql mysql 18M Nov 22 04:47 ibdata1

-rw-rw---- 1 mysql mysql 5.0M Nov 27 05:52 ib_logfile0

-rw-rw---- 1 mysql mysql 5.0M Apr 13 2018 ib_logfile1

drwx------ 2 mysql mysql 4.0K Apr 13 2018 mysql

srwxrwxrwx 1 mysql mysql 0 Nov 27 05:52 mysql.sock

-rw-r----- 1 mysql mysql 5.8K Apr 13 2018 newdomainname.err

drwx------ 2 mysql mysql 12K Nov 22 00:57 domainname

drwx------ 2 mysql mysql 4.0K Apr 13 2018 performance_schema

-rw-r--r-- 1 mysql mysql 286 Apr 13 2018 RPM_UPGRADE_HISTORY

-rw-r--r-- 1 mysql mysql 286 Apr 13 2018 RPM_UPGRADE_MARKER-LAST

netstat -ntlp

Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 1303/php-fpm: maste tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 783/mysqld
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/systemd
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1329/nginx: master
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1285/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1159/master
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 1329/nginx: master
tcp6 0 0 :::111 :::* LISTEN 1/systemd
tcp6 0 0 :::80 :::* LISTEN 1329/nginx: master
tcp6 0 0 :::22 :::* LISTEN 1285/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1159/master

ps -ef | grep mysqld

root 660 1 0 05:52 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe

mysql 783 660 0 05:52 ? 00:00:02 /usr/sbin/mysqld --basedir=/usr --

datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-

error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --

socket=/var/lib/mysql/mysql.sock

root 2650 1022 0 06:54 pts/1 00:00:00 grep --color=auto mysqld

/var/log/mysqld.log 显示如下:

https://i.imgur.com/4yKhZ2d.png

https://i.imgur.com/YYuAO6G.png

请问如何解决呢?问题到底出在哪里了?

12084 次点击
所在节点    程序员
1 条回复
kmdd33
2018-11-27 15:20:28 +08:00
执行了:# journalctl -xe

发现:

# journalctl -xe
-- Unit mysqld.service has begun starting up.
Nov 27 07:18:32 newoneacreland systemd[3106]: Failed at step EXEC spawning /usr/bin/mysqld_safe
-- Subject: Process /usr/bin/mysqld_safe could not be executed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- The process /usr/bin/mysqld_safe could not be executed and failed.
--
-- The error number returned by this process is 13.
Nov 27 07:18:32 newoneacreland systemd[1]: mysqld.service: main process exited, code=exited, st
Nov 27 07:18:33 newoneacreland systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysqld.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysqld.service has failed.
--
-- The result is failed.
Nov 27 07:18:33 newoneacreland systemd[1]: Unit mysqld.service entered failed state.
Nov 27 07:18:33 newoneacreland systemd[1]: mysqld.service failed.
Nov 27 07:18:33 newoneacreland systemd[1]: mysqld.service holdoff time over, scheduling restart
Nov 27 07:18:33 newoneacreland systemd[1]: start request repeated too quickly for mysqld.servic
Nov 27 07:18:33 newoneacreland systemd[1]: Failed to start MySQL Community Server.

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/511976

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX