Home > Database > Mysql Tutorial > How to delete mysql-bin

How to delete mysql-bin

藏色散人
Release: 2023-02-15 10:05:10
Original
2945 people have browsed it

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.

How to delete mysql-bin

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;
Copy after login

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
Copy after login

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template