我在 CentOS 7 上安装了 MySQL 服务器。但是,我停止了它一次,现在我无法重新启动它,因为我收到此错误:
Failed to start database :
Redirecting to /bin/systemctl start mariadb.service
Job for mariadb.service failed because the control process exited with error code. See "systemctl status mariadb.service" and "journalctl -xe" for details.
我已经使用 MySQL 很多年了,但这是我要迁移到的新服务器,我从未听说过 MariaDB,所以我不知道它是什么。你能帮我修复这个错误吗?
谢谢。
完整错误日志
â— mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2017-03-17 13:48:21 EDT; 2min 13s ago
Process: 10775 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=1/FAILURE)
Process: 10774 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=1/FAILURE)
Process: 10746 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
Main PID: 10774 (code=exited, status=1/FAILURE)
Mar 17 13:48:20 server mysqld_safe[10774]: 170317 13:48:20 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Mar 17 13:48:20 server mysqld_safe[10774]: /usr/bin/mysqld_safe: line 139: /var/log/mariadb/ma riadb.log: Permission denied
Mar 17 13:48:20 server mysqld_safe[10774]: /usr/bin/mysqld_safe: line 183: /var/log/mariadb/ma riadb.log: Permission denied
Mar 17 13:48:20 server mysqld_safe[10774]: 170317 13:48:20 mysqld_safe mysqld from pid file /v ar/run/mariadb/mariadb.pid ended
Mar 17 13:48:20 server mysqld_safe[10774]: /usr/bin/mysqld_safe: line 139: /var/log/mariadb/ma riadb.log: Permission denied
Mar 17 13:48:20 server systemd[1]: mariadb.service: main process exited, code=exited, status=1 /FAILURE
Mar 17 13:48:21 server systemd[1]: mariadb.service: control process exited, code=exited status =1
Mar 17 13:48:21 server systemd[1]: Failed to start MariaDB database server.
Mar 17 13:48:21 server systemd[1]: Unit mariadb.service entered failed state.
Mar 17 13:48:21 server systemd[1]: mariadb.service failed.
答案1
找出运行 MariaDB 的用户,并确保/var/log/mariadb
目录中的日志文件归该用户所有。