[root@pc4 mysql]# systemctl status mysqld
● mysqld.service - MySQL Server by xuda
Loaded: loaded (/etc/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sun 2023-01-22 22:00:27 CST; 58s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 11790 ExecStart=/application/mysql/bin/mysqld --default-file=/etc/my.cnf (code=exited, status=1/FAILURE)
Main PID: 11790 (code=exited, status=1/FAILURE)
Jan 22 22:00:23 pc4 systemd[1]: Started MySQL Server by xuda.
Jan 22 22:00:27 pc4 systemd[1]: mysqld.service: main process exited, c...RE
Jan 22 22:00:27 pc4 systemd[1]: Unit mysqld.service entered failed state.
Jan 22 22:00:27 pc4 systemd[1]: mysqld.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
看了MySQL的错误日志,发现:
2023-01-22T14:11:12.679082Z 0 [ERROR] [MY-000067] [Server] unknown variable 'default-file=/etc/my.cnf'.
原来是“default-file=/etc/my.cnf”少了一个“s”,应为“defaults-file=/etc/my.cnf”。
修改文件,重新加载
systemctl daemon-reload
启动,成功了
[root@pc4 mysql]# systemctl status mysqld
● mysqld.service - MySQL Server by xuda
Loaded: loaded (/etc/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Sun 2023-01-22 22:14:40 CST; 20s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Main PID: 12125 (mysqld)
Tasks: 38
CGroup: /system.slice/mysqld.service
└─12125 /application/mysql/bin/mysqld --defaults-file=/etc/my.cnf
Jan 22 22:14:40 pc4 systemd[1]: Started MySQL Server by xuda.
来源地址:https://blog.csdn.net/Baobob_banana/article/details/128750684