Clear and disable MySQL BinaryLogs

Source: Internet
Author: User
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
  1. Usemysql -u root -pLog on to the server.

  2. 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 |+-------------------+-----------+
  3. FLUSH LOGS;

  4. 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.