首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >mysql.service的作业失败,因为控制进程退出并返回错误代码

mysql.service的作业失败,因为控制进程退出并返回错误代码
EN

Stack Overflow用户
提问于 2021-08-16 03:38:36
回答 1查看 322关注 0票数 1

我已经安装了MySQL-server,在防火墙中启用了端口3306,然后执行了sudo systemctl restart mysql,我收到错误:-

Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.

在查看了systemctl status mysql.service之后,我得到了日志:

代码语言:javascript
运行
复制
● mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Sun 2021-08-15 20:11:40 PDT; 132ms ago
    Process: 2801384 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
    Process: 2801392 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
   Main PID: 2801392 (code=exited, status=1/FAILURE)
     Status: "Server startup in progress"
      Error: 99 (Cannot assign requested address)

然后,我在this stackoverflow answer的帮助下修复了Process: 2801392 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)行的错误。然后我再一次执行

systemctl status mysql.service我得到了一段时间的日志:

代码语言:javascript
运行
复制
     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
     Active: activating (start) since Sun 2021-08-15 20:11:38 PDT; 541ms ago
    Process: 2801384 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
   Main PID: 2801392 (mysqld)
     Status: "Server startup in progress"
      Tasks: 13 (limit: 309219)
     Memory: 248.2M
     CGroup: /system.slice/mysql.service
             └─2801392 /usr/sbin/mysqld

但是几秒钟后,日志再次开始显示前一个(code=exited,status=1/FAILURE)。

还有journalctl -xe的日志:-

代码语言:javascript
运行
复制
-- Support: http://www.ubuntu.com/support
--
-- An ExecStart= process belonging to unit mysql.service has exited.
--
-- The process' exit code is 'exited' and its exit status is 1.
Aug 15 20:16:13 si-gpu1.linkgrid.com systemd[1]: mysql.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit mysql.service has entered the 'failed' state with result 'exit-code'.
Aug 15 20:16:13 si-gpu1.linkgrid.com systemd[1]: Failed to start MySQL Community Server.
-- Subject: A start job for unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit mysql.service has finished with a failure.
--
-- The job identifier is 5422093 and the job result is failed.
Aug 15 20:16:14 si-gpu1.linkgrid.com systemd[1]: mysql.service: Scheduled restart job, restart counter is at 199.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Automatic restarting of the unit mysql.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Aug 15 20:16:14 si-gpu1.linkgrid.com systemd[1]: Stopped MySQL Community Server.
-- Subject: A stop job for unit mysql.service has finished
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A stop job for unit mysql.service has finished.
--
-- The job identifier is 5422193 and the job result is done.
Aug 15 20:16:14 si-gpu1.linkgrid.com systemd[1]: Starting MySQL Community Server...
-- Subject: A start job for unit mysql.service has begun execution
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit mysql.service has begun execution.

在下面的this之后给出了日志:

代码语言:javascript
运行
复制
 mysql.service: Scheduled restart job, restart counter is at 628.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Automatic restarting of the unit mysql.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Aug 15 20:35:38 si-gpu1.linkgrid.com systemd[1]: Stopped MySQL Community Server.
-- Subject: A stop job for unit mysql.service has finished
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A stop job for unit mysql.service has finished.
--
-- The job identifier is 5465197 and the job result is done.
Aug 15 20:35:38 si-gpu1.linkgrid.com sshd[2830014]: Invalid user support from 122.53.65.209 port 63290
Aug 15 20:35:38 si-gpu1.linkgrid.com systemd[1]: Starting MySQL Community Server...
-- Subject: A start job for unit mysql.service has begun execution
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit mysql.service has begun execution.

我做了很多事情(包括重新安装),这是在网上提到的。但都不管用。“我只会启动服务器。”

EN

回答 1

Stack Overflow用户

发布于 2021-11-03 10:33:21

尝试以下命令:

代码语言:javascript
运行
复制
/etc/init.d/mysql stop

service mysql stop

killall -KILL mysql mysqld_safe mysqld

/etc/init.d/mysql start

service mysql start
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68797150

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档