Centos7安装 mariadb启动错误解决

本人遇到mariadb 启动错误的故障解决过程分享。

故障现象

Centos7 使用 yum -y install mariadb mariadb-server  安装完成mariadb后启动错误。

错误信息:

[root@iZ882mt6umfZ ~]# systemctl status mariadb.service

[0m mariadb.service - MariaDB database server

Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)

Active: failed (Result: exit-code) since Fri 2019-03-01 09:25:54 CST; 9s ago

Process: 309 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=1/FAILURE)

Process: 308 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=0/SUCCESS)

Process: 32745 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)

Main PID: 308 (code=exited, status=0/SUCCESS)

Mar 01 09:25:53 iZ882mt6umfZ systemd[1]: Starting MariaDB database server...

Mar 01 09:25:53 iZ882mt6umfZ mariadb-prepare-db-dir[32745]: Database MariaDB is probably initialized in /var/lib/mysql already, nothing is done.

Mar 01 09:25:53 iZ882mt6umfZ mariadb-prepare-db-dir[32745]: If this is not the case, make sure the /var/lib/mysql is empty before running mariad...db-dir.

Mar 01 09:25:53 iZ882mt6umfZ mysqld_safe[308]: 190301 09:25:53 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.

Mar 01 09:25:53 iZ882mt6umfZ mysqld_safe[308]: 190301 09:25:53 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

Mar 01 09:25:54 iZ882mt6umfZ systemd[1]: mariadb.service: control process exited, code=exited status=1

Mar 01 09:25:54 iZ882mt6umfZ systemd[1]: Failed to start MariaDB database server.

Mar 01 09:25:54 iZ882mt6umfZ systemd[1]: Unit mariadb.service entered failed state.

Mar 01 09:25:54 iZ882mt6umfZ systemd[1]: mariadb.service failed.

解决方案:

yum install mariadb*

chown -R mysql:mysql /var/lib/mysql/

启动正常:

root@iZ882mt6umfZ ~]# systemctl start mariadb

[root@iZ882mt6umfZ ~]# systemctl status mariadb

[0m mariadb.service - MariaDB database server

Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)

Active: active (running) since Fri 2019-03-01 09:38:58 CST; 13s ago

Process: 1875 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=0/SUCCESS)

Process: 1843 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)

Main PID: 1874 (mysqld_safe)


你可能感兴趣的:(Centos7安装 mariadb启动错误解决)