无法在 Fedora 20 上启动 MySQL

无法在 Fedora 20 上启动 MySQL

我是 Fedora 和 MySQL 的新手。我刚刚安装了 Fedora 20(虚拟),然后安装了 Apache 并启动了它,然后安装了 MySQL。当我尝试使用此命令启动 MySQL 时:

sudo service mysqld start

我明白了:

Redirecting to /bin/systemctl start  mysqld.service
Job for mariadb.service failed. See 'systemctl status mariadb.service' and 'journalctl -xn' for details.

我搜索了一下,找到了另一个启动MySQL的命令:

systemctl start mysqld.service

第二个命令返回了相同的结果。正如它所暗示的,我尝试了:

 systemctl status mariadb.service

它提供了一些信息:

 mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled)
   Active: failed (Result: exit-code) since Thu 2014-02-13 09:23:19 IRST; 13min ago
  Process: 22189 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=1/FAILURE)
  Process: 22188 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=1/FAILURE)
  Process: 22165 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
 Main PID: 22188 (code=exited, status=1/FAILURE)
   CGroup: /system.slice/mariadb.service

Feb 13 09:23:18 localhost.localdomain mariadb-prepare-db-dir[22165]: chmod: changing permissions of ‘/var/log/mariadb/mariadb.log’: Opera...mitted
Feb 13 09:23:18 localhost.localdomain mysqld_safe[22188]: 140213 09:23:18 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
Feb 13 09:23:18 localhost.localdomain mysqld_safe[22188]: 140213 09:23:18 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Feb 13 09:23:18 localhost.localdomain mysqld_safe[22188]: /usr/bin/mysqld_safe: line 138: /var/log/mariadb/mariadb.log: Permission denied
Feb 13 09:23:18 localhost.localdomain mysqld_safe[22188]: /usr/bin/mysqld_safe: line 182: /var/log/mariadb/mariadb.log: Permission denied
Feb 13 09:23:18 localhost.localdomain mysqld_safe[22188]: 140213 09:23:18 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended
Feb 13 09:23:18 localhost.localdomain systemd[1]: mariadb.service: main process exited, code=exited, status=1/FAILURE
Feb 13 09:23:19 localhost.localdomain systemd[1]: mariadb.service: control process exited, code=exited status=1
Feb 13 09:23:19 localhost.localdomain systemd[1]: Failed to start MariaDB database server.
Feb 13 09:23:19 localhost.localdomain systemd[1]: Unit mariadb.service entered failed state.
Hint: Some lines were ellipsized, use -l to show in full.

所以Failed to start MariaDB database server.我不知道 MariaDB 到底是什么,所以我阅读了一些有关 MySQL 和 MariaDB 之间的差异的文章,但这并没有帮助解决我的问题。你能告诉我我该怎么做吗?

答案1

第 138 行:/var/log/mariadb/mariadb.log:权限被拒绝

看起来 /var/log/mariadb 目录的权限错误,mysql 无法写入。检查一下。通常会为数据库的运行创建一个 mysql 用户/组,因此如下所示:

chown -R mysql.mysql /var/log/mariadb

很可能会解决你的麻烦。

相关内容