Stop MySQL log in Linux and delete mysql-bin.0000* log file

Source: Internet
Author: User

Access to the site today, the database link error, and then want to restart the LNMP environment, found that the MySQL service can not be properly shut down, recall that the server has been running smoothly for 4 months, the configuration should not have any problems, so think, may be the data disk space used up, sure enough. Just think of the log file should be caused, and finally check to MySQL log file over, and incredibly several log files several G. Well, it seems the problem is out here. Baidu to Military brother's blog, deleted all mysql-bin.0000* log files, restart on OK, conveniently put the MySQL log function closed.

LNMP installation of a key install the MySQL default is to open the log file, if the data operation is more frequent will produce a lot of log, under/usr/local/mysql/var/produce mysql-bin.0000* similar files, And generally in dozens of MB to a few GB, more will eat the entire hard disk space, never lead to MySQL can not start or error.

How to turn off the MySQL log feature:

To delete a log:

Perform:

/usr/local/mysql/bin/mysql-u root-p

Enter the password for the database root user to log in and then execute: RESET master;

Re-enter: Quit exit MySQL command mode.

Completely disable MySQL log: Modify/etc/my.cnf file, find

Log-bin=mysql-bin
Binlog_format=mixed

Then add the # to the two lines, comment them out, and then execute/etc/init.d/mysql restart.

If you really want to keep the log, you can add expire_logs_days = 10 in/etc/my.cnf and restart MySQL so that the log is automatically cleaned in 10 days.

In this paper, an example of installing a LNMP installation package may be slightly different from the MySQL reboot command and profile path

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.