MariaDB 服务无法启动

MariaDB 服务无法启动

我尝试重新启动它,但仍然没有成功。我看过一些帖子,但不是同样的问题。服务器是 CentOS Linux 版本 7.5.1804(核心)

systemctl status mariadb 的输出是:

● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sat 2020-05-02 05:54:22 -05; 7min ago
Process: 26120 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=1/FAILURE)

May 02 05:54:22 srv01web-taws systemd[1]: Starting MariaDB database server...
May 02 05:54:22 srv01web-taws systemd[1]: mariadb.service: control process exited, code=exited status=1
May 02 05:54:22 srv01web-taws systemd[1]: Failed to start MariaDB database server.
May 02 05:54:22 srv01web-taws systemd[1]: Unit mariadb.service entered failed state.
May 02 05:54:22 srv01web-taws systemd[1]: mariadb.service failed.

我尝试重新启动时的输出是:

Job for mariadb.service failed because the control process exited with error code. See "systemctl status mariadb.service" and "journalctl -xe" for details.

'journalctl -xe' 的输出是:

-- Unit user-48.slice has finished shutting down.
May 02 06:09:02 srv01web-taws systemd[1]: Stopping User Slice of apache.
-- Subject: Unit user-48.slice has begun shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit user-48.slice has begun shutting down.
May 02 06:10:01 srv01web-taws systemd[1]: Created slice User Slice of apache.
-- Subject: Unit user-48.slice has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit user-48.slice has finished starting up.
--
-- The start-up result is done.
May 02 06:10:01 srv01web-taws systemd[1]: Starting User Slice of apache.
-- Subject: Unit user-48.slice has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit user-48.slice has begun starting up.
May 02 06:10:01 srv01web-taws systemd[1]: Started Session 248209 of user apache.
-- Subject: Unit session-248209.scope has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-248209.scope has finished starting up.
--
-- The start-up result is done.
May 02 06:10:01 srv01web-taws systemd[1]: Starting Session 248209 of user apache.
-- Subject: Unit session-248209.scope has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-248209.scope has begun starting up.
May 02 06:10:01 srv01web-taws CROND[27027]: (apache) CMD (/usr/bin/php  /var/www/html/moodle/admin/cli/cron.php >/dev/null)
May 02 06:10:03 srv01web-taws systemd[1]: Removed slice User Slice of apache.
-- Subject: Unit user-48.slice has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit user-48.slice has finished shutting down.
May 02 06:10:03 srv01web-taws systemd[1]: Stopping User Slice of apache.
-- Subject: Unit user-48.slice has begun shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit user-48.slice has begun shutting down.

答案1

从提供的信息来看,尚不清楚问题的根本原因是什么。您可以在输出中看到启动服务时systemctl status mariadb命令失败。/usr/libexec/mariadb-prepare-db-dir

我猜想在大多数情况下这与权限问题和/或 mariadb 配置中的路径配置错误有关。

为了进一步调试,我将/usr/libexec/mariadb-prepare-db-dir使用单元文件中定义的 mariadb 用户手动执行。您可以使用它systemctl show mariadb来获取正确的用户名。还要检查 mariadb 配置中是否存在错误路径(实际数据库文件的路径以及日志路径)

相关内容