MYSQL 启动失败

异常信息

● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since 一 2021-07-19 17:01:31 CST; 3min 0s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 2027 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=1/FAILURE)
  Process: 2009 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)

7月 19 17:01:30 localhost.localdomain systemd[1]: Failed to start MySQL Server.
7月 19 17:01:30 localhost.localdomain systemd[1]: Unit mysqld.service entered failed state.
7月 19 17:01:30 localhost.localdomain systemd[1]: mysqld.service failed.
7月 19 17:01:31 localhost.localdomain systemd[1]: mysqld.service holdoff time over, scheduling restart.
7月 19 17:01:31 localhost.localdomain systemd[1]: Stopped MySQL Server.
7月 19 17:01:31 localhost.localdomain systemd[1]: start request repeated too quickly for mysqld.service
7月 19 17:01:31 localhost.localdomain systemd[1]: Failed to start MySQL Server.
7月 19 17:01:31 localhost.localdomain systemd[1]: Unit mysqld.service entered failed state.
7月 19 17:01:31 localhost.localdomain systemd[1]: mysqld.service failed.

解决方法

  1. 检查polkit.service
[root@localhost /]# systemctl status polkit.service
● polkit.service - Authorization Manager
  Loaded: loaded (/usr/lib/systemd/system/polkit.service; static; vendor preset: enabled)
  Active: failed (Result: timeout) since 一 2021-07-19 16:56:05 CST; 23min ago
    Docs: man:polkit(8)
 Process: 857 ExecStart=/usr/lib/polkit-1/polkitd --no-debug (code=killed, signal=TERM)
Main PID: 857 (code=killed, signal=TERM)

7月 19 16:54:35 localhost.localdomain systemd[1]: Starting Authorization Manager...
7月 19 16:54:46 localhost.localdomain polkitd[857]: Started polkitd version 0.112
7月 19 16:54:52 localhost.localdomain polkitd[857]: Loading rules from directory /etc/polkit-1/rules.d
7月 19 16:54:52 localhost.localdomain polkitd[857]: Loading rules from directory /usr/share/polkit-1/rules.d
7月 19 16:55:01 localhost.localdomain polkitd[857]: Finished loading, compiling and executing 10 rules
7月 19 16:55:01 localhost.localdomain polkitd[857]: Acquired the name org.freedesktop.PolicyKit1 on the system bus
7月 19 16:56:05 localhost.localdomain systemd[1]: polkit.service start operation timed out. Terminating.
7月 19 16:56:05 localhost.localdomain systemd[1]: Failed to start Authorization Manager.
7月 19 16:56:05 localhost.localdomain systemd[1]: Unit polkit.service entered failed state.
7月 19 16:56:05 localhost.localdomain systemd[1]: polkit.service failed.

1.1 启动失败 执行

  • Ensure the existence of a polkitd system user & group(检查并有条件的创建用户/组)
getent group polkitd >/dev/null && echo -e "\e[1;32mpolkitd group already exists\e[0m" || { groupadd -r polkitd && echo -e "\e[1;33mAdded missing polkitd group\e[0m" || echo -e "\e[1;31mAdding polkitd group FAILED\e[0m"; }
getent passwd polkitd >/dev/null && echo -e "\e[1;32mpolkitd user already exists\e[0m" || { useradd -r -g polkitd -d / -s /sbin/nologin -c "User for polkitd" polkitd && echo -e "\e[1;33mAdded missing polkitd user\e[0m" || echo -e "\e[1;31mAdding polkitd user FAILED\e[0m"; }
  • Reset the permissions and user/group ownership for all files provided by the polkit and polkit-pkla-compat packages检查并有条件的重置用户/组和所有权
rpm -Va polkit\* && echo -e "\e[1;32mpolkit* rpm verification passed\e[0m" || { echo -e "\e[1;33mResetting polkit* rpm user/group ownership & perms\e[0m"; rpm --setugids polkit polkit-pkla-compat; rpm --setperms polkit polkit-pkla-compat; }

  • 重启 ,并确保polkit已重新连接到dbus
  1. 上一步已处理完成 出现
............
                                                     
7月 19 17:31:16 localhost.localdomain setroubleshoot[3360]: failed to retrieve rpm info for /xxxx/data/mysql/ib_buffer_pool
7月 19 17:31:16 localhost.localdomain setroubleshoot[3360]: SELinux is preventing /usr/sbin/mysqld from getattr access on the file /xxxx/data/mysql/ib_buffer_pool. For complete SELinux messages run: sea
7月 19 17:31:16 localhost.localdomain python[3360]: SELinux is preventing /usr/sbin/mysqld from getattr access on the file /xxxx/data/mysql/ib_buffer_pool.

  • 临时关闭
[root@localhost ~]# getenforce
Enforcing

[root@localhost ~]# /usr/sbin/sestatus
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   enforcing
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      31

[root@localhost ~]# setenforce 0

[root@localhost ~]# /usr/sbin/sestatus
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   permissive
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      31

[root@localhost ~]# systemctl start mysqld.service
# 发现可以启动

你可能感兴趣的:(系统运维,mysql,启动失败)