温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

关于运行mysql_install_db命令导致sudo systemctl start /restart mariadb.service启动失败问题

发布时间:2020-08-10 19:27:07 来源:网络 阅读:3766 作者:斜月流明 栏目:MySQL数据库

运行环境:centos 7

数据库:mariadb

问题描述:在yum安装mariadb数据库运行后运行了/var/lib/mysql_install_db命令,从而导致mariadb数据库启动或重启都失败。

故障解决:

[centos@centos mysql]$ sudo systemctl start mariadb.service  
Job for mariadb.service failed because the control process exited with error code. See "systemctl status mariadb.service" and "journalctl -xe" for details.

通过问题描述,首先想到的是运行sudo journalctl -xe 查看以下问题详细信息,但是经查看并没有比较详细的error描述,使我想到了/var/log/mariadb/error.log,经查看获取了以下错误信息,mysqld: File './mysql-bin.000013' not found (Errcode: 13),根据提示,查看到底是不是mysql-bin.000013二进制日志文件丢失,ls -l /var/lib/mysql/经查看此文件存在,但却发现此文件的属主与属主和其他文件属主与属组权限不一样,改其属主和属组 sudo chown mysql.mysql mysql-bin.000013,重新启动mariadb问题得以解决。

总结:

在linux下大多数故障的发生都有日志文件的记录,遇到问题不要惊慌,首先查看问题描述,然后通过日志文件描述来解决问题。不要盲目网上查答案。


[centos@centos mysql]$ sudo journalctl -xe  
--
-- Unit mariadb.service has begun shutting down.
11月 04 18:22:46 centos systemd[1]: Stopped MariaDB database server.
-- Subject: Unit mariadb.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mariadb.service has finished shutting down.
11月 04 18:22:46 centos polkitd[636]: Unregistered Authentication Agent for unix-process:13180:865667 (system bus name :1.197,
11月 04 18:22:57 centos sudo[13209]:   centos : TTY=pts/1 ; PWD=/var/lib/mysql ; USER=root ; COMMAND=/bin/systemctl start mari
11月 04 18:22:57 centos polkitd[636]: Registered Authentication Agent for unix-process:13210:866892 (system bus name :1.198 [/
11月 04 18:22:57 centos 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.
11月 04 18:22:57 centos mariadb-prepare-db-dir[13217]: Database MariaDB is probably initialized in /var/lib/mysql already, not
11月 04 18:22:57 centos mariadb-prepare-db-dir[13217]: If this is not the case, make sure the /var/lib/mysql is empty before r
11月 04 18:22:57 centos mysqld_safe[13252]: 171104 18:22:57 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
11月 04 18:22:57 centos mysqld_safe[13252]: 171104 18:22:57 mysqld_safe Starting mysqld daemon with databases from /var/lib/my
11月 04 18:23:03 centos systemd[1]: mariadb.service: control process exited, code=exited status=1
11月 04 18:23:03 centos 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.
11月 04 18:23:03 centos systemd[1]: Unit mariadb.service entered failed state.
11月 04 18:23:03 centos systemd[1]: mariadb.service failed.
11月 04 18:23:03 centos polkitd[636]: Unregistered Authentication Agent for unix-process:13210:866892 (system bus name :1.198,
11月 04 18:23:16 centos sudo[13683]:   centos : TTY=pts/1 ; PWD=/var/lib/mysql ; USER=root ; COMMAND=/bin/journalctl -xe


[centos@centos mysql]$ sudo tail -n 30 /var/log/mariadb/error.log

171104 18:22:59 Percona XtraDB (http://www.percona.com) 5.5.52-MariaDB-38.3 started; log sequence number 1597964
171104 18:22:59 [Note] Plugin 'FEEDBACK' is disabled.
171104 18:22:59 [ERROR] mysqld: File './mysql-bin.000013' not found (Errcode: 13)
171104 18:22:59 [ERROR] Failed to open log (file './mysql-bin.000013', errno 13)
171104 18:22:59 [ERROR] Could not open log file
171104 18:22:59 [ERROR] Can't init tc log
171104 18:22:59 [ERROR] Aborting


    

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI