Clear and disable Binarylogs bitsCN.com of MySQL
Clear and disable Binary logs of MySQL
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.
Turn it off
Edit/etc/mysql/my. cnf, locate the log-bin option, and comment it out. if expire_logs_days expire_cnf exists, comment it out.
...# log-bin# expire_logs_days = 10...
Clear existing logs
First, use mysql-u root-p to log 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;
So far, Binary Logs has been permanently disabled.
BitsCN.com