mysql启动不了

问题背景

service mysqld stop
没办法停止mysqld ,未找到其根本原因,直接暴力kill掉mysql 进程

然而 service mysqld start 又启动【FAILED】

这个时候, 脑抽地直接

[root@localhost~]# mysql
ERROR 2002(HY000): Can’t connect to local MySQL server through socket '/usr/local/mysql/mysql.sock(2)

这个纯粹就是瞎操作,mysql都没启动,哪里来的mysql.sock……

分析问题

然后 直接看mysqld的日志 /usr/local/mysql/mysqld.log:

190423 12:57:24 InnoDB: Started; log sequence number 0 978132042
/usr/libexec/mysqld: Error writing file ‘/var/run/mysqld/mysqld-slow.log’ (Errcode: 28)
190423 12:57:24 [ERROR] Could not use /var/run/mysqld/mysqld-slow.log for logging (error 28). Turning logging off for the whole duration of the MySQL server process. To turn it on again: fix the cause, shutdown the MySQL server and restart it.
190423 12:57:24 [Note] Recovering after a crash using mysql-bin
190423 12:57:25 [ERROR] Error in Log_event::read_log_event(): ‘read error’, data_len: 5091, event_type: 2
190423 12:57:25 [Note] Starting crash recovery…
190423 12:57:25 [Note] Crash recovery finished.
04:57:25 UTC - mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.

看ERROR , 在使用mysql-slow.log 的时候出了问题,第二个ERROR 是 recover 操作日志 环节出了问题

到/var/lib/mysql 下面看 mysql-bin.00000x 操作日志巨大……

再继续找日志

190423 11:04:35 [Warning] Disk is full writing ‘./mysql-bin.000006’ (Errcode: 28). Waiting for someone to free space… (Expect up to 60 secs delay for server to continue after freeing disk space)
190423 11:04:35 [Warning] Retry in 60 secs. Message reprinted in 600 secs
190423 11:14:35 [Warning] Disk is full writing ‘./mysql-bin.000006’ (Errcode: 28). Waiting for someone to free space… (Expect up to 60 secs delay for server to continue after freeing disk space)
190423 11:14:35 [Warning] Retry in 60 secs. Message reprinted in 600 secs
190423 11:24:35 [Warning] Disk is full writing ‘./mysql-bin.000006’ (Errcode: 28). Waiting for someone to free space… (Expect up to 60 secs delay for server to continue after freeing disk space)
190423 11:24:35 [Warning] Retry in 60 secs. Message reprinted in 600 secs
190423 11:34:35 [Warning] Disk is full writing ‘./mysql-bin.000006’ (Errcode: 28). Waiting for someone to free space… (Expect up to 60 secs delay for server to continue after freeing disk space)
190423 11:34:35 [Warning] Retry in 60 secs. Message reprinted in 600 secs

看样子,disk is full ……

尝试解决

尝试将 /var/lib/mysql下面的文档 全部mv到其他地方(比如/home/backupvarlibmysql)(千万不要删啊不要删……)

尝试启动mysql
ok 启动成功。

这时候相当于是将mysql 初始化了 里面除了mysql,test, information_schema ,其他的库表都没有了……比如你有个库叫happy, 但是这个happy没有了……

重新/home/backupvarlibmysql/happy 文件夹mv回到/var/lib/mysql
然后 chown -R mysql.mysql /var/lib/mysql/happy

再service mysqld restart
就可以了

ps mysql-bin.0000x 是操作日志

你可能感兴趣的:(Mysql)