MySQL log file Mysql-bin file Cleanup method, and configuration of mysql-bin related files

Source: Internet
Author: User

By default, MySQL will keep the mysql-bin file, so that at some point, the disk may be full, whether it is possible to delete these files, whether it can be safely deleted, is a problem.

First of all, these files are MySQL log files, if not the master from the copy, it is basically useless, although useless, but not recommended to use the RM command to delete, it may be unsafe, the correct way is to remove the MySQL command.

Mysql-U root-PEnterPassword: Welcometo theMysqlMonitor. Commands End With ; Or\g.Your MysqlConnection IDIs 2819416ServerVersion: 5.5.24-0ubuntu0.12.04.1-Log(Ubuntu)Copyright (C) 2000, 2011, Oracle and/OrIts affiliates. AllRights reserved.Oracle IsA registered trademark ofOracle Corporation and/OrItsaffiliates. OtherNames may trademarks of their respectiveowners.type  ' help; '  or  ' \h ' for Help.type  ' \c '  to clear the current input Statement. Mysql> reset Master;query Ok, 0  rows affected  (3 min  37.65 Sec)           

In fact, the key command is that reset master; this command will empty the Mysql-bin file.

In addition, if your MySQL server does not need to master from the copy, it is recommended to modify the My.cnf file, to set not to generate these files, as long as the deletion of MY.CNF in the following line is possible.

Log-bin=MySQL-bin     

If you need to copy, it is a good idea to control the number of days these log files remain, which can be set by the following configuration:

=7

Indicates that the log is retained for 7 days, so that old logs are automatically cleaned out.

MySQL log file Mysql-bin file Cleanup method, and configuration of mysql-bin related files

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.