How to delete MySQL binary logs

Source: Internet
Author: User

The following describes how to use commands to quickly delete MySQL binary logs. Because sometimes the binary files are too large, we need to clear them. The following describes the specific operation steps.

120 gb ssd space is used on the server. After checking, it is found that the binary log of MySQL is not cleared in time, occupying a large amount of space. Therefore, you can directly use the command: the reset master is deleted.

The Code is as follows: Copy code

Reset master

If the database on the MySQL server performs replication, do not use this command. Instead, use the purge binary logs command. Purge is mild, and there are usually two ways to execute it:

The Code is as follows: Copy code

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

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

To delete MySQL binary logs, you can also use the following method. when expire_logs_days = 3 is added to cnf/ini, MySQL will only keep the logs of the last three days, so you don't have to bother reset them all the time.

The 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.