刚安装的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启动项权限没有放开,无法启动。