Method to delete mysql-bin: 1. Delete the "mysql-bin" file through the "mysql> reset master; reset slave;" command; 2. Delete the "log-bin=" in "my.cnf" mysql-bin" is one line.
The operating environment of this tutorial: Windows 10 system, MySQL version 5.7, Dell G3 computer.
How to delete mysql-bin?
mysql master-slave log file mysql-bin file clearing method
By default, mysql will always retain the mysql-bin file, so at a certain point, the disk may be full. Whether these files can be deleted at this time and whether they can be deleted safely is a question. It is not recommended to use the rm command to delete, which may be unsafe. The correct way is to delete them through the mysql command.
mysql> reset master; mysql> reset slave;
In fact, the key command is reset master; this command will clear the mysql-bin file.
In addition, if your mysql server does not require master-slave replication, it is recommended to modify the my.cnf file to set these files not to be generated. Just delete the following line in my.cnf. That's it.
log-bin=mysql-bin
If you need to copy, it is best to control the number of days that these log files are retained. You can set the number of days that log files are retained through the following configuration:
expire_logs_days = 3
means retaining logs for 3 days, so that old logs will be automatically cleared
Recommended learning: "MySQL Video Tutorial"
The above is the detailed content of How to delete mysql-bin. For more information, please follow other related articles on the PHP Chinese website!