mariadb(mysql)报错:Job for mariadb.service failed because the control process exited with error code解决

mariadb(mysql)启动报错报错:Job for mariadb.service failed because the control process exited with error code解决方案

[root@localhost ~]# systemctl start mariadb #1===============执行,返回值给出2个命令查询报错详细记录
Job for mariadb.service failed because the control process exited with error code. See "systemctl status mariadb.service" and "journalctl -xe" for details.
[root@localhost ~]# systemctl status mariadb.service  #2===============查原因,可见下面有一行指示mysqld_safe进程将本次报错的错误信息写入到 mysqld_safe Logging to '/var/lib/mysql/localhost.localdomain.err'.
● mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2020-02-26 00:08:45 CST; 3s ago
  Process: 62359 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=1/FAILURE)
  Process: 62358 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=0/SUCCESS)
  Process: 62323 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
 Main PID: 62358 (code=exited, status=0/SUCCESS)

Feb 26 00:08:44 localhost.localdomain mysqld_safe[62358]: [76B blob data]
Feb 26 00:08:44 localhost.localdomain mysqld_safe[62358]: Fatal error in defaults handling. Program aborted
Feb 26 00:08:44 localhost.localdomain mysqld_safe[62358]: [76B blob data]
Feb 26 00:08:44 localhost.localdomain mysqld_safe[62358]: Fatal error in defaults handling. Program aborted
Feb 26 00:08:44 localhost.localdomain mysqld_safe[62358]: 200226 00:08:44 mysqld_safe Logging to '/var/lib/mysql/localhost.localdomain.err'.
Feb 26 00:08:44 localhost.localdomain mysqld_safe[62358]: 200226 00:08:44 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Feb 26 00:08:45 localhost.localdomain systemd[1]: mariadb.service: control process exited, code=exited status=1
Feb 26 00:08:45 localhost.localdomain systemd[1]: Failed to start MariaDB database server.
Feb 26 00:08:45 localhost.localdomain systemd[1]: Unit mariadb.service entered failed state.
Feb 26 00:08:45 localhost.localdomain systemd[1]: mariadb.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]# journalctl -xe #3===============查原因,可见下面有一行指示mysqld_safe进程将本次报错的错误信息写入到 mysqld_safe Logging to '/var/lib/mysql/localhost.localdomain.err'.
-- A new session with the ID 22 has been created for the user root.
--
-- The leading process of the session is 62055.
Feb 26 00:08:44 localhost.localdomain polkitd[3329]: Registered Authentication Agent for unix-process:62311:2515352 (system bus name :1.90 [/us
Feb 26 00:08:44 localhost.localdomain systemd[1]: Starting MariaDB database server...
-- Subject: Unit mariadb.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mariadb.service has begun starting up.
Feb 26 00:08:44 localhost.localdomain mariadb-prepare-db-dir[62323]: [76B blob data]
Feb 26 00:08:44 localhost.localdomain mariadb-prepare-db-dir[62323]: Fatal error in defaults handling. Program aborted
Feb 26 00:08:44 localhost.localdomain mariadb-prepare-db-dir[62323]: [76B blob data]
Feb 26 00:08:44 localhost.localdomain mariadb-prepare-db-dir[62323]: Fatal error in defaults handling. Program aborted
Feb 26 00:08:44 localhost.localdomain mariadb-prepare-db-dir[62323]: [76B blob data]
Feb 26 00:08:44 localhost.localdomain mariadb-prepare-db-dir[62323]: Fatal error in defaults handling. Program aborted
Feb 26 00:08:44 localhost.localdomain mariadb-prepare-db-dir[62323]: Database MariaDB is probably initialized in /var/lib/mysql already, nothin
Feb 26 00:08:44 localhost.localdomain mariadb-prepare-db-dir[62323]: If this is not the case, make sure the /var/lib/mysql is empty before runn
Feb 26 00:08:44 localhost.localdomain mariadb-wait-ready[62359]: [76B blob data]
Feb 26 00:08:44 localhost.localdomain mariadb-wait-ready[62359]: Fatal error in defaults handling. Program aborted
Feb 26 00:08:44 localhost.localdomain mariadb-wait-ready[62359]: [76B blob data]
Feb 26 00:08:44 localhost.localdomain mariadb-wait-ready[62359]: Fatal error in defaults handling. Program aborted
Feb 26 00:08:44 localhost.localdomain mysqld_safe[62358]: [76B blob data]
Feb 26 00:08:44 localhost.localdomain mysqld_safe[62358]: Fatal error in defaults handling. Program aborted
Feb 26 00:08:44 localhost.localdomain mysqld_safe[62358]: [76B blob data]
Feb 26 00:08:44 localhost.localdomain mysqld_safe[62358]: Fatal error in defaults handling. Program aborted
Feb 26 00:08:44 localhost.localdomain mysqld_safe[62358]: 200226 00:08:44 mysqld_safe Logging to '/var/lib/mysql/localhost.localdomain.err'.
Feb 26 00:08:44 localhost.localdomain mysqld_safe[62358]: 200226 00:08:44 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Feb 26 00:08:45 localhost.localdomain systemd[1]: mariadb.service: control process exited, code=exited status=1
Feb 26 00:08:45 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.
Feb 26 00:08:45 localhost.localdomain systemd[1]: Unit mariadb.service entered failed state.
Feb 26 00:08:45 localhost.localdomain systemd[1]: mariadb.service failed.
Feb 26 00:08:45 localhost.localdomain polkitd[3329]: Unregistered Authentication Agent for unix-process:62311:2515352 (system bus name :1.90, o

[root@localhost ~]# tail -n 100 /var/lib/mysql/localhost.localdomain.err #4===============查原因,看mysqd_safe的日志文件,我们注意到返回值中有下面的行200226 00:08:44 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
/usr/libexec/mysqld: Can't read dir of '/etc/my.cnf.de' (Errcode: 2),即不能读取/etc/my.cnf.de文件,我们找到该文件是否真正在系统中存在,如果不存在,那么可能你的地址写错误了。
200225 20:55:32 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended
200225 20:55:54 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
/usr/libexec/mysqld: Can't read dir of '/etc/my.cnf.de' (Errcode: 2)
Fatal error in defaults handling. Program aborted
200225 20:55:54 mysqld_safe mysqld from pid file /var/lib/mysql/localhost.localdomain.pid ended
200225 22:23:31 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
/usr/libexec/mysqld: Can't read dir of '/etc/my.cnf.de' (Errcode: 2)
Fatal error in defaults handling. Program aborted
200225 22:23:31 mysqld_safe mysqld from pid file /var/lib/mysql/localhost.localdomain.pid ended
200225 22:25:33 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
/usr/libexec/mysqld: Can't read dir of '/etc/my.cnf.de' (Errcode: 2)
Fatal error in defaults handling. Program aborted
200225 22:25:33 mysqld_safe mysqld from pid file /var/lib/mysql/localhost.localdomain.pid ended
200225 22:25:49 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
/usr/libexec/mysqld: Can't read dir of '/etc/my.cnf.de' (Errcode: 2)
Fatal error in defaults handling. Program aborted
200225 22:25:49 mysqld_safe mysqld from pid file /var/lib/mysql/localhost.localdomain.pid ended
200226 00:08:44 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
/usr/libexec/mysqld: Can't read dir of '/etc/my.cnf.de' (Errcode: 2)
Fatal error in defaults handling. Program aborted
200226 00:08:44 mysqld_safe mysqld from pid file /var/lib/mysql/localhost.localdomain.pid ended
[root@localhost ~]# grep 'my.cnf.de' /etc/my.cnf /etc/my.cnf.d/* #5===========在相关配置文件中,查询my.cnf.de的位置,进行修改,经过实际检测系统中确实没有找到该文件。
/etc/my.cnf:!includedir /etc/my.cnf.de

你可能感兴趣的:(mysql)