我尝试启动 mariadb,但无法启动 maria db,我不知道为什么。我正在运行带有 mariadb 的 centos 7。当我重新启动时它无法启动,当我使用 cli 启动它时,它显示以下内容:
[root@localhost mariadb]# systemctl start mariadb.service
Job for mariadb.service failed. See 'systemctl status mariadb.service' and 'journalctl -xn' for details.
当我检查日志时,它给出了这个错误:
[root@localhost mariadb]# journalctl -xn
-- Logs begin at Sun 2015-05-17 12:38:39 CEST, end at Sun 2015-05-17 13:51:37 CEST. --
May 17 13:45:10 localhost.localdomain systemd[1]: Unit mariadb.service entered failed state.
May 17 13:51:35 localhost.localdomain systemd[1]: Starting MariaDB database server...
-- Subject: Unit mariadb.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mariadb.service has begun starting up.
May 17 13:51:35 localhost.localdomain mariadb-prepare-db-dir[7079]: Failed to get D-Bus connection: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
May 17 13:51:35 localhost.localdomain mariadb-prepare-db-dir[7079]: Failed to get D-Bus connection: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
May 17 13:51:35 localhost.localdomain mysqld_safe[7107]: 150517 13:51:35 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
May 17 13:51:35 localhost.localdomain mysqld_safe[7107]: 150517 13:51:35 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
May 17 13:51:36 localhost.localdomain mysqld_safe[7107]: 150517 13:51:36 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended
May 17 13:51:37 localhost.localdomain systemd[1]: mariadb.service: control process exited, code=exited status=1
May 17 13:51:37 localhost.localdomain systemd[1]: Failed to start MariaDB database server.
-- Subject: Unit mariadb.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mariadb.service has failed.
--
-- The result is failed.
May 17 13:51:37 localhost.localdomain systemd[1]: Unit mariadb.service entered failed state.
我该如何修复无法获取 D-Bus 连接:无法连接到套接字 /var/run/dbus/system_bus_socket:没有此文件或目录错误?
答案1
使用以下方法可修复:
[root@localhost mariadb]# nano /etc/my.cnf
然后我取消注释了我的 pid 文件
#pid-file=/var/run/mariadb/mariadb.pid
然后我重新启动了 mariadb