Centos7下root用戶啓動Mysql5.7報“Failed to get properties: Access denied”

剛安裝的Mysql數據庫,root用戶systemctl status mysqld.service啓動mysql時,一直報權限不足,排查了各種文件,放開了權限,還是一直報“Failed to get properties: Access denied”。

確定所有跟mysql相關的文件都屬於mysql用戶組,權限也放開的情況下啓動時,仍報權限不足,如圖:

[root@localhost data]# /bin/systemctl status mysqld.service
Failed to get properties: Access denied

最後發現是防火牆沒關,關閉防火牆。

[root@localhost data]# setenforce 0
[root@localhost data]# /bin/systemctl status mysqld.service
● mysqld.service - LSB: start and stop MySQL
   Loaded: loaded (/etc/rc.d/init.d/mysqld; disabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since 四 2020-07-02 15:03:57 CST; 1h 21min ago
     Docs: man:systemd-sysv-generator(8)
 Main PID: 115373 (code=exited, status=0/SUCCESS)

7月 02 15:03:57 localhost.localdomain systemd[1]: Failed to start MySQL Server.
7月 02 15:03:57 localhost.localdomain systemd[1]: Unit mysqld.service entered failed state.
7月 02 15:03:57 localhost.localdomain systemd[1]: mysqld.service failed.
7月 02 15:03:57 localhost.localdomain systemd[1]: mysqld.service holdoff time over, scheduling restart.
7月 02 15:03:57 localhost.localdomain systemd[1]: Stopped MySQL Server.
7月 02 15:03:57 localhost.localdomain systemd[1]: start request repeated too quickly for mysqld.service
7月 02 15:03:57 localhost.localdomain systemd[1]: Failed to start MySQL Server.
7月 02 15:03:57 localhost.localdomain systemd[1]: Unit mysqld.service entered failed state.
7月 02 15:03:57 localhost.localdomain systemd[1]: mysqld.service failed.
Warning: mysqld.service changed on disk. Run 'systemctl daemon-reload' to reload units.
[root@localhost data]# /bin/systemctl start mysqld.service
Warning: mysqld.service changed on disk. Run 'systemctl daemon-reload' to reload units.
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.

查看mysql狀態,Mysql狀態已經修改,需要重新加載配置選項,reload下。然後再次啓動,並查看mysql狀態。

[root@localhost data]# systemctl daemon-reload
[root@localhost data]# /bin/systemctl start mysqld.service
[root@localhost data]# /bin/systemctl status mysqld.service
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: disabled)
   Active: active (running) since 四 2020-07-02 16:26:36 CST; 5s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 121919 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
  Process: 121863 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 121921 (mysqld)
   CGroup: /system.slice/mysqld.service
           └─121921 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid --skip-grant-tables

7月 02 16:26:32 localhost.localdomain systemd[1]: Starting MySQL Server...
7月 02 16:26:36 localhost.localdomain systemd[1]: Started MySQL Server.

啓動正常。

注:個人遇到的問題,並一定是所以這種情況都這樣處理,更多這種問題還是權限不足造成,mysql啓動項權限沒有放開,無法啓動。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章