当前位置:   article > 正文

mysql服务无法启动故障小记_mariadb server is down

mariadb server is down

问题背景:当在ubuntu中使用systemctl status mysqld.service时,输出如下(或类似):

  1. ● mariadb.service - MariaDB database server
  2. Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
  3. Active: failed (Result: exit-code) since Wed 2016-11-02 16:55:12 IST; 3min 6s ago
  4. Process: 5123 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
  5. Process: 5070 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl set
  6. Process: 5067 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
  7. Main PID: 5123 (code=exited, status=1/FAILURE)
  8. Status: "MariaDB server is down"
  9. Nov 02 16:55:11 pranav-laptop systemd[1]: Starting MariaDB database server...
  10. Nov 02 16:55:12 pranav-laptop mysqld[5123]: 2016-11-02 16:55:12 140082509282496 [Note] /usr/sbin/mysqld (mysqld 10.1.18-MariaDB) starting as process 5
  11. Nov 02 16:55:12 pranav-laptop mysqld[5123]: 2016-11-02 16:55:12 140082509282496 [Warning] Can't create test file /var/lib/mysql/pranav-laptop.lower-te
  12. Nov 02 16:55:12 pranav-laptop mysqld[5123]: [90B blob data]
  13. Nov 02 16:55:12 pranav-laptop systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
  14. Nov 02 16:55:12 pranav-laptop systemd[1]: Failed to start MariaDB database server.
  15. Nov 02 16:55:12 pranav-laptop systemd[1]: mariadb.service: Unit entered failed state.
  16. Nov 02 16:55:12 pranav-laptop systemd[1]: mariadb.service: Failed with result 'exit-code'.

,可使用下面的方法先删除数据库文件(如无重要文件):

$rm -rf /var/lib/mysql/*

删除后再重新初始化数据库目录:

 $mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql 

安装完成后会提示重启mysql服务并设置密码,详见提示。

systectl start mysqld.service

......

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/628176
推荐阅读
相关标签
  

闽ICP备14008679号