Recently, MySQL has suddenly flown in, and BinaryLog eats more than MIB of hard disk space, interfering with the normal operation of the system. There are many solutions, including directly deleting files and clearing logs one by one using SQL statements. However, I still prefer to use standard operations. To clear existing logs, first use mysql-uroot-p to log on to the server.
Recently, MySQL has suddenly flown in. Binary Log eats more than 800 MiB of hard disk space, which interferes with the normal operation of the system. There are many solutions, including directly deleting files and clearing logs one by one using SQL statements. However, I still prefer to use standard operations. To clear existing logs, use mysql-u root-p to log on to the server.
Recently, MySQL has suddenly flown in. Binary Log eats more than 800 MiB of hard disk space, which interferes with the normal operation of the system. There are many solutions, including directly deleting files and clearing logs one by one using SQL statements. However, I still prefer to use standard operations.
Clear existing logs
-
Usemysql -u root -pLog on to the server.
-
SHOW BINARY LOGS;
First, let's take a look at how many logs we have and how much space we have. There are so many.
+-------------------+-----------+| Log_name | File_size |+-------------------+-----------+| mysqld-bin.000001 | 264 || mysqld-bin.000002 | 1546 || mysqld-bin.000003 | 11728 || mysqld-bin.000004 | 122291346 || mysqld-bin.000005 | 264 || mysqld-bin.000006 | 958 || mysqld-bin.000007 | 85263 || mysqld-bin.000008 | 467392 || mysqld-bin.000009 | 271736 || mysqld-bin.000010 | 264 || mysqld-bin.000011 | 2670 || mysqld-bin.000012 | 5258576 || mysqld-bin.000013 | 25406 || mysqld-bin.000014 | 430000 || mysqld-bin.000015 | 560172 || mysqld-bin.000016 | 45971600 || mysqld-bin.000017 | 62227475 || mysqld-bin.000018 | 223992121 || mysqld-bin.000019 | 91294894 || mysqld-bin.000020 | 4796916 |+-------------------+-----------+
-
FLUSH LOGS;
-
RESET MASTER;
Turn it off
Edit/etc/mysql/my.cnf, Findlog-binOption, comment out; if anyexpire_logs_days.
...# log-bin# expire_logs_days = 10...
So far, Binary Logs has been permanently disabled.
Original Articles are licensed using the Attribution-license Alike 3.0 China Mainland license agreement.
Original article address: clear and disable MySQL's Binary Logs. Thank you for sharing it.