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 |