Delete MySQL binary log specific method

Source: Internet
Author: User

Server 120G SSD hard disk space used 92%, after inspection found that the original MySQL binary log is not in time to remove, occupy a lot of space, so directly with the command: Reset master a delete clean.

The code is as follows Copy Code

Reset Master

If the database on the MySQL server is replication, do not use the command, but should use: Purge binary logs command. Purge is more moderate and usually has two ways of doing it:

The code is as follows Copy Code

Purge binary logs to ' mysql-bin.010 ';

Purge binary logs before ' 2012-05-02 22:46:26 ';

Remove MySQL binary log, there is a more convenient way, just add in the My.cnf/ini Expire_logs_days=3,mysql will only keep the last 3 days of the log, not always bother to reset.

  code is as follows copy code

1 expire_ logs_days=3

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.