Fedora 27:反复出现错误“Job for失败,因为控制进程退出并出现错误代码”

Fedora 27:反复出现错误“Job for失败,因为控制进程退出并出现错误代码”

我已经使用 docker 安装了 MySQL,直到出现此错误之前它才工作,我的笔记本电脑由于某种原因关闭,我重新启动了我的虚拟机(在 Fedora 27 上),当我尝试启动 mysql 服务时,我面临以下错误。我也尝试开始sudo service docker restart我得到同样的错误。所以我无法启动docker或mysql服务器,最后我删除了docker安装的软件包sudo dnf remove docker-ce,然后安装MySQL 5.7社区服务器参考MySQL 5.7安装指南

我不知道我的 Linux 操作系统级别是否有任何损坏???

[ravibeli@localdomain ~]$ sudo service mysqld start

Logs:
[sudo] password for ravibeli: 
Starting mysqld (via systemctl):  Job for mysqld.service failed because the control process exited with error code.
See "systemctl  status mysqld.service" and "journalctl  -xe" for details.
                                                           [FAILED]

当我运行“journalctl -xe”时,显示以下错误消息,并且无法修复它?在 VM (Fedora 27) 上解决此问题的方法是什么

[ravibeli@localdomain ~]$ journalctl -xe

May 07 16:06:53 localdomain sudo[6971]: pam_unix(sudo:session): session opened for user root by (uid=0)
May 07 16:06:53 localdomain audit[6971]: USER_START pid=6971 uid=0 auid=1000 ses=2 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:sess
May 07 16:06:53 localdomain systemd[1]: Starting SYSV: MySQL database server....
-- Subject: Unit mysqld.service has begun start-up
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysqld.service has begun starting up.
May 07 16:06:53 localdomain mysqld[8145]: chown: invalid user: ‘mysql:mysql’
May 07 16:06:54 localdomain audit[726]: USER_AVC pid=726 uid=81 auid=4294967295 ses=4294967295 subj=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 msg='avc: 
                                         exe="/usr/bin/dbus-daemon" sauid=81 hostname=? addr=? terminal=?'
May 07 16:06:54 localdomain mysqld[8145]: Initializing MySQL database:  2018-05-07T10:36:54.847676Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is depre
May 07 16:06:54 localdomain mysqld[8145]: 2018-05-07T10:36:54.851156Z 0 [ERROR] Fatal error: Can't change to run as user 'mysql' ;  Please check that the user
May 07 16:06:54 localdomain mysqld[8145]: 2018-05-07T10:36:54.851678Z 0 [ERROR] Aborting
May 07 16:06:54 localdomain mysqld[8145]: [FAILED]
May 07 16:06:54 localdomain systemd[1]: mysqld.service: Control process exited, code=exited status=1
May 07 16:06:54 localdomain systemd[1]: Failed to start SYSV: MySQL database server..
-- Subject: Unit mysqld.service has failed
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mysqld.service has failed.
-- 
-- The result is failed.
May 07 16:06:54 localdomain systemd[1]: mysqld.service: Unit entered failed state.
May 07 16:06:54 localdomain systemd[1]: mysqld.service: Failed with result 'exit-code'.
May 07 16:06:54 localdomain audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=mysqld comm="systemd
May 07 16:06:54 localdomain sudo[6971]: pam_unix(sudo:session): session closed for user root
May 07 16:06:54 localdomain audit[6971]: USER_END pid=6971 uid=0 auid=1000 ses=2 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:sessio
May 07 16:06:54 localdomain audit[6971]: CRED_DISP pid=6971 uid=0 auid=1000 ses=2 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=PAM:setcr
lines 1393-1422/1422

答案1

日志日志表明用户mysql可能不存在。从上面我可以看到你是以用户身份登录的拉维贝利

Fatal error: Can't change to run as user 'mysql' ;  Please check that the user

检查用户是否mysql运行以下命令,它应该返回一个有效的用户 ID,如果不存在,则该用户不存在,您需要解决这个问题 - 很可能是 mysqld 或 Docker 配置问题:

id -u mysql

如果用户确实存在,请尝试使用系统控制启动服务:

systemctl start mysqld.service

mysqld服务有一个日志文件位于/var/log/mysqld.log,如果上述方法均不起作用,则此日志文件可能包含有关该问题的更多详细信息 - 请将其添加到您的问题中,我们也许能够为您提供进一步帮助。

正如您所说,用户和组确实存在,请/var/lib/mysql通过运行以下命令检查哪个用户拥有该文件夹:

ls -l /var/lib/mysql

如果mysql用户不拥有该文件,然后使用以下命令更改所有权:

chown mysql:mysql -R /var/lib/mysql

相关内容