文章详情

短信预约-IT技能 免费直播动态提醒

请输入下面的图形验证码

提交验证

短信预约提醒成功

MySQL服务启动异常:Failed to start MySQL Server. mysqld.service holdoff time over, scheduling restart.

2023-10-21 18:17

关注

MySQL服务启动异常

在这里插入图片描述

systemctl status mysqld
● mysqld.service - MySQL Server   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)   Active: failed (Result: start-limit) since 二 2023-07-18 20:15:00 CST; 2min 19s ago     Docs: man:mysqld(8)           http://dev.mysql.com/doc/refman/en/using-systemd.html  Process: 4357 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=1/FAILURE)  Process: 4085 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)7月 18 20:14:59 localhost.localdomain systemd[1]: Failed to start MySQL Server.7月 18 20:14:59 localhost.localdomain systemd[1]: Unit mysqld.service entered failed state.7月 18 20:14:59 localhost.localdomain systemd[1]: mysqld.service failed.7月 18 20:15:00 localhost.localdomain systemd[1]: mysqld.service holdoff time over, scheduling restart.7月 18 20:15:00 localhost.localdomain systemd[1]: Stopped MySQL Server.7月 18 20:15:00 localhost.localdomain systemd[1]: start request repeated too quickly for mysqld.service7月 18 20:15:00 localhost.localdomain systemd[1]: Failed to start MySQL Server.7月 18 20:15:00 localhost.localdomain systemd[1]: Unit mysqld.service entered failed state.7月 18 20:15:00 localhost.localdomain systemd[1]: mysqld.service failed.
systemctl start mysqld

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

chown

chown是一个常用的Linux/Unix命令,用于改变文件或目录的所有者(owner)。它的主要作用是将文件或目录的所有权转移给指定的用户或用户组。

chown命令的语法如下:

chown [选项] 用户名:用户组 文件/目录
其中,常用的选项包括:

-R:递归地改变指定目录及其子目录下的文件和目录的所有权。
-c:只在执行改变所有权操作时显示提示信息。
-v:显示详细的操作信息。
使用chown命令,可以实现以下功能:

转移文件/目录的所有权:可以将文件/目录的所有者更改为其他用户。
chown 用户名 文件/目录
转移用户组所有权:可以将文件/目录的用户组更改为其他用户组。
chown :用户组 文件/目录
同时转移所有者和用户组所有权:可以将文件/目录的所有者和用户组同时更改为其他用户和用户组。
chown 用户名:用户组 文件/目录
递归改变文件/目录的所有权:通过添加 -R 选项,可以递归地改变指定目录及其子目录下的所有文件和目录的所有权。
chown -R 用户名:用户组 目录
chown命令常用于系统管理员或文件的所有者进行文件/目录的权限管理。它可以帮助确保合适的用户或用户组拥有适当的访问权限,并提高系统的安全性和可管理性。
使用chown授予目录里权限

chown mysql:mysql -R /var/lib/mysql
chown mysql -R /var/lib/mysql
systemctl start mysqld

Job for mysqld.service failed because the control process exited with error code. See “systemctl status mysqld.service” and “journalctl -xe” for details.
[root@localhost ~]# journalctl -xe
Then execute:
restorecon -v ‘/cdh/logs/mysqld.log’

                        Plugin catchall (17.1 confidence) suggests                   If you believe that mysqld should be allowed append access on the mysqld.log file by default.                      Then you should report this as a bug.                      You can generate a local policy module to allow this access.                      Do                      allow this access for now by executing:                      # ausearch -c 'mysqld' --raw | audit2allow -M my-mysqld                      # semodule -i my-mysqld.pp

7月 18 20:24:15 localhost.localdomain setroubleshoot[11170]: failed to retrieve rpm info for /cdh/logs/mysqld.log
7月 18 20:24:15 localhost.localdomain setroubleshoot[11170]: SELinux is preventing /usr/sbin/mysqld from append access on the file /cdh/logs/mysqld.log. For complete SELinux messages run: sealert -l 4f2a
7月 18 20:24:15 localhost.localdomain python[11170]: SELinux is preventing /usr/sbin/mysqld from append access on the file /cdh/logs/mysqld.log.

                      *****  Plugin catchall_labels (83.8 confidence) suggests   *******************                If you want to allow mysqld to have append access on the mysqld.log file                      Then you need to change the label on /cdh/logs/mysqld.log                      Do                      # semanage fcontext -a -t FILE_TYPE '/cdh/logs/mysqld.log'                      where FILE_TYPE is one of the following: NetworkManager_log_t, NetworkManager_tmp_t, abrt_tmp_t, abrt_upload_watch_tmp_t, abrt_var_cache_t, abrt_var_                      Then execute:                      restorecon -v '/cdh/logs/mysqld.log'


​ ***** Plugin catchall (17.1 confidence) suggests **************************

                      If you believe that mysqld should be allowed append access on the mysqld.log file by default.                      Then you should report this as a bug.                      You can generate a local policy module to allow this access.                      Do                      allow this access for now by executing:                      # ausearch -c 'mysqld' --raw | audit2allow -M my-mysqld                      # semodule -i my-mysqld.pp

lines 2190-2228/2228 (END)
Then execute:
restorecon -v ‘/cdh/logs/mysqld.log’

                      *****  Plugin catchall (17.1 confidence) suggests   **************************                If you believe that mysqld should be allowed append access on the mysqld.log file by default.                      Then you should report this as a bug.                      You can generate a local policy module to allow this access.                      Do                      allow this access for now by executing:                      # ausearch -c 'mysqld' --raw | audit2allow -M my-mysqld                      # semodule -i my-mysqld.pp

7月 18 20:24:15 localhost.localdomain setroubleshoot[11170]: failed to retrieve rpm info for /cdh/logs/mysqld.log
7月 18 20:24:15 localhost.localdomain setroubleshoot[11170]: SELinux is preventing /usr/sbin/mysqld from append access on the file /cdh/logs/mysqld.log. For complete SELinux messages run: sealert -l 4f2a4ed9-4
7月 18 20:24:15 localhost.localdomain python[11170]: SELinux is preventing /usr/sbin/mysqld from append access on the file /cdh/logs/mysqld.log.

                      *****  Plugin catchall_labels (83.8 confidence) suggests   *******************                If you want to allow mysqld to have append access on the mysqld.log file                      Then you need to change the label on /cdh/logs/mysqld.log                      Do                      # semanage fcontext -a -t FILE_TYPE '/cdh/logs/mysqld.log'                      where FILE_TYPE is one of the following: NetworkManager_log_t, NetworkManager_tmp_t, abrt_tmp_t, abrt_upload_watch_tmp_t, abrt_var_cache_t, abrt_var_log_t,                      Then execute:                      restorecon -v '/cdh/logs/mysqld.log'


​ ***** Plugin catchall (17.1 confidence) suggests **************************

                      If you believe that mysqld should be allowed append access on the mysqld.log file by default.                      Then you should report this as a bug.                      You can generate a local policy module to allow this access.                      Do                      allow this access for now by executing:                      # ausearch -c 'mysqld' --raw | audit2allow -M my-mysqld                      # semodule -i my-mysqld.pp

~
~
~
lines 2190-2228/2228 (END)
Then execute:
restorecon -v ‘/cdh/logs/mysqld.log’

                      *****  Plugin catchall (17.1 confidence) suggests   **************************                If you believe that mysqld should be allowed append access on the mysqld.log file by default.                      Then you should report this as a bug.                      You can generate a local policy module to allow this access.                      Do                      allow this access for now by executing:                      # ausearch -c 'mysqld' --raw | audit2allow -M my-mysqld                      # semodule -i my-mysqld.pp

7月 18 20:24:15 localhost.localdomain setroubleshoot[11170]: failed to retrieve rpm info for /cdh/logs/mysqld.log
7月 18 20:24:15 localhost.localdomain setroubleshoot[11170]: SELinux is preventing /usr/sbin/mysqld from append access on the file /cdh/logs/mysqld.log. For complete SELinux messages run: sealert -l 4f2a
7月 18 20:24:15 localhost.localdomain python[11170]: SELinux is preventing /usr/sbin/mysqld from append access on the file /cdh/logs/mysqld.log.

                      *****  Plugin catchall_labels (83.8 confidence) suggests   *******************                If you want to allow mysqld to have append access on the mysqld.log file                      Then you need to change the label on /cdh/logs/mysqld.log                      Do                      # semanage fcontext -a -t FILE_TYPE '/cdh/logs/mysqld.log'                      where FILE_TYPE is one of the following: NetworkManager_log_t, NetworkManager_tmp_t, abrt_tmp_t, abrt_upload_watch_tmp_t, abrt_var_cache_t, abrt_var_                      Then execute:                      restorecon -v '/cdh/logs/mysqld.log'


​ ***** Plugin catchall (17.1 confidence) suggests **************************

                      If you believe that mysqld should be allowed append access on the mysqld.log file by default.                      Then you should report this as a bug.                      You can generate a local policy module to allow this access.                      Do                      allow this access for now by executing:                      # ausearch -c 'mysqld' --raw | audit2allow -M my-mysqld                      # semodule -i my-mysqld.pp

重点错误信息:

7月 18 20:24:15 localhost.localdomain setroubleshoot[11170]: SELinux is preventing /usr/sbin/mysqld from append access on the file /cdh/logs/mysqld.log. For complete SELinux messages run: sealert -l 4f2a

SELinux(Security-Enhanced Linux)是一个安全增强的Linux安全模块,它提供了Linux系统级别的强制访问控制(MAC)机制。它的目标是通过附加强制访问控制机制,限制进程的权限,并提供更细粒度的访问控制来增强系统的安全性。

相对于传统的Linux访问控制方式(基于用户和权限的访问控制),SELinux引入了基于角色的访问控制和类型强制访问控制。它通过在内核中实施安全策略和访问规则来限制进程对资源的访问,并控制进程间的相互作用。

getenforce是一个用于查看SELinux当前状态的命令。它通常用于检查SELinux的执行模式,以确定SELinux是启用还是禁用,并获取其当前的执行级别。

getenforce

Enforcing

[root@localhost ~]# setenforce 0[root@localhost ~]# sed -i 's/^SELINUX=.*/SELINUX=disabled/'  /etc/selinux/config[root@localhost ~]# getenforce

Permissive

[root@localhost ~]# systemctl start mysqld[root@localhost ~]# systemctl status mysqld

● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since 二 2023-07-18 20:26:07 CST; 5s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 13063 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
Process: 13036 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 13066 (mysqld)
Tasks: 30
CGroup: /system.slice/mysqld.service
└─13066 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

7月 18 20:26:06 localhost.localdomain systemd[1]: Starting MySQL Server…
7月 18 20:26:07 localhost.localdomain systemd[1]: Started MySQL Server.

来源地址:https://blog.csdn.net/programmer589/article/details/131796977

阅读原文内容投诉

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

软考中级精品资料免费领

  • 历年真题答案解析
  • 备考技巧名师总结
  • 高频考点精准押题
  • 2024年上半年信息系统项目管理师第二批次真题及答案解析(完整版)

    难度     813人已做
    查看
  • 【考后总结】2024年5月26日信息系统项目管理师第2批次考情分析

    难度     354人已做
    查看
  • 【考后总结】2024年5月25日信息系统项目管理师第1批次考情分析

    难度     318人已做
    查看
  • 2024年上半年软考高项第一、二批次真题考点汇总(完整版)

    难度     435人已做
    查看
  • 2024年上半年系统架构设计师考试综合知识真题

    难度     224人已做
    查看

相关文章

发现更多好内容

猜你喜欢

AI推送时光机
位置:首页-资讯-数据库
咦!没有更多了?去看看其它编程学习网 内容吧
首页课程
资料下载
问答资讯