MySQL runs for a long time there will be a lot of mysql-bin.xxxx files, each is quite large.
This is the binary file of MySQL. It records all MySQL database operations, such as all your SQL statements.
This file is useful when the database crashes or data is lost.
Master-slave synchronization can also ensure data consistency between the master and slave databases based on this log.
But it cannot grow at all. One day it will fill up the disk, so it should be processed in a timely manner.
The processing method is as follows:
Single-Host:
Turn off the binary log directly. Find log-bin in my. ini or my. CNF and comment it out.
If you still want to retain binary logs for a period of time, configure regular cleaning,
Or configure expire_logs_days in my file
For example:
Expire_logs_days = 10
When a master-slave server is available:
This requires manual deletion, and check which log is being operated by the slave server, or delete the log of the unsynchronized data.
The method is as follows:
1. Run show slave status on the slave server to check which log is being read from the slave server .;
2. Run show on the master server.
Master logs to view the current log list;
3. Delete all logs before the logs being read from the server
Purge master logs to 'Operation log name ';
Purge master logs before 'time ';
For example:
Purge master logs to 'mysql-binlimit 99 ';
Purge master logs before '2017-12-01 21:00:00 ';