Home > Database > Mysql Tutorial > body text

磁盘爆满导致MySQL无法启动:Disk is full writing &#x27_MySQL

WBOY
Release: 2016-05-31 08:46:43
Original
1816 people have browsed it

今天收到监控邮件说博客访问失败。打开页面一看,硕大的502 Bad Gateway,ping了一下VPS发现是通的,SSH连接上去看了下Nginx日志发现没问题,重启lnmp的时候发现Mysql起不来,问题源头基本找到。

tail /usr/local/mysql/var/slyar.err

看了一下Mysql的错误日志,意外状况出现……

Disk is full writing './mysql-bin.~rec~' (Errcode: 28). Waiting for someone to free space... (Expect up to 60 secs delay for server to continue after freeing disk space)

神奇的情况,居然是因为磁盘满了无法写入日志导致Mysql起不来。

root@slyar#

df 

Filesystem 1K-blocks Used Available Use% Mounted on 

/dev/sda1 3016688 2877540 0 100% /  

果然啊,/var目录爆了。

root@slyar:/usr/local/mysql/var# ll --block-size=MB

total 504MB

-rw-rw---- 1 mysql mysql 26MB Jul 23 2012 mysql-bin.000011

-rw-rw---- 1 mysql mysql 5MB Jul 26 2012 mysql-bin.000012

-rw-rw---- 1 mysql mysql 27MB Aug 8 2012 mysql-bin.000013

-rw-rw---- 1 mysql mysql 43MB Aug 23 2012 mysql-bin.000014

-rw-rw---- 1 mysql mysql 270MB Feb 9 17:05 mysql-bin.000020

-rw-rw---- 1 mysql mysql 115MB Apr 19 12:27 mysql-bin.000021

-rw-rw---- 1 mysql mysql 1MB Feb 10 12:07 mysql-bin.index

-rw-rw---- 1 mysql mysql 0MB Apr 19 12:34 mysql-bin.~rec~

基本上就是被这些玩意占满了,查了一下Mysql手册发现这些东西也没啥用,直接删除(此操作最好在Mysql服务停止时进行,因为当前日志使用的话无法删除,而且有可能导致一些其它问题,不过用mysql>reset master命令可以直接清空日志)。

root@slyar:/usr/local/mysql/var#rm -f  ./mysql-bin.* 

为了防止再次出现此类状况,直接关闭Mysql的log-bin日志功能。

vim /etc/my.cnf

找到:

log-bin=mysql-binbinlog_format=mixed

在前面加上#注释掉,:wq保存退出。

最后:

/etc/init.d/mysql restart

启动Mysql服务,一切正常。

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template