赞
踩
问题背景:当在ubuntu中使用systemctl status mysqld.service时,输出如下(或类似):
- ● mariadb.service - MariaDB database server
- Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
- Active: failed (Result: exit-code) since Wed 2016-11-02 16:55:12 IST; 3min 6s ago
- Process: 5123 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
- Process: 5070 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl set
- Process: 5067 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
- Main PID: 5123 (code=exited, status=1/FAILURE)
- Status: "MariaDB server is down"
-
- Nov 02 16:55:11 pranav-laptop systemd[1]: Starting MariaDB database server...
- 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
- 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
- Nov 02 16:55:12 pranav-laptop mysqld[5123]: [90B blob data]
- Nov 02 16:55:12 pranav-laptop systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
- Nov 02 16:55:12 pranav-laptop systemd[1]: Failed to start MariaDB database server.
- Nov 02 16:55:12 pranav-laptop systemd[1]: mariadb.service: Unit entered failed state.
- 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
......
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。