Solve the problem that MySQL cannot be started because the log space is full

Source: Internet
Author: User
Tags mysql manual

This article will introduce to you how to solve the problem that MySQL cannot be started due to full log space. If you encounter such problems, you can refer to it.

Today, I received a monitoring email saying that my blog Access failed. Open the page and check that the huge 502 Bad Gateway, ping the VPS, And the SSH connection, and check the Nginx log, when lnmp is restarted, Mysql cannot be started, and the source of the problem is basically found.

The Code is as follows: Copy code

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

I checked the Mysql Error Log and encountered an unexpected situation...

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

The magic is that Mysql cannot be started because the disk is full and logs cannot be written.

The Code is as follows: Copy code

Root @ slyar # df
Filesystem 1K-blocks Used Available Use % Mounted on
/Dev/sda1 3016688 2877540 0 100%/

Sure enough, the/var directory burst.

The Code is as follows: Copy code

Root @ slyar:/usr/local/mysql/var # ll -- block-size = MB
All 504 MB
-Rw ---- 1 mysql 26 MB Jul 23 2012 mysql-bin.000011
-Rw ---- 1 mysql 5 MB Jul 26 2012 mysql-bin.000012
-Rw ---- 1 mysql 27 MB Aug 8 2012 mysql-bin.000013
-Rw ---- 1 mysql 43 MB Aug 23 2012 mysql-bin.000014
-Rw ---- 1 mysql 270 MB Feb 9 mysql-bin.000020
-Rw ---- 1 mysql 115 MB Apr 19 mysql-bin.000021
-Rw ---- 1 mysql 1 MB Feb 10 12: 07 mysql-bin.index
-Rw ---- 1 mysql 0 MB Apr 19 12:34 mysql-bin .~ Rec ~

Basically, these things are full. I checked the Mysql manual and found that these things are useless and deleted directly (this operation is best performed when the Mysql service is stopped, the current log cannot be deleted if used, and it may cause some other problems. However, you can directly clear the log using the mysql> reset master command)

The Code is as follows: Copy code

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

To prevent this problem from happening again, directly disable the log-bin function of Mysql.

The Code is as follows: Copy code

Vim/etc/my. cnf

Find:

The Code is as follows: Copy code
Log-bin = mysql-bin
Binlog_format = mixed

Add # comment out before: wq save and exit

Last

The Code is as follows: Copy code

/Etc/init. d/mysql restart

Start the Mysql service. Everything is normal.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.