Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of large space occupied by quot;mysql-bin.000001"

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "how to solve the problem of"mysql-bin.000001"occupying a large space". In the operation process of actual cases, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

The server has been down frequently in recent months, resulting in unguaranteed availability of Bill's lid. But it is also strange to say that when the machine is down, the server can connect normally, Nginx also seems normal, but PHP-FPM loses its response. Later inadvertently df -h, found:

rootfs 7.7G 7.7G 0 100% /

The root directory is full! I think there are too many logs, so I clean up the logs. But basically every week the journal fills up. It's got bill's lid on it. Later,/var was partitioned independently, but it still didn't work. /var/tmp and/var/cache have also been cleaned up, but the effect is still limited.

Today, patience du -ah, found/var/lib/mysql takes up space exception, cd to here ls -lh found after:

-rw-rw---- 1 mysql mysql 5242880 Feb 27 14:49 ib_logfile0

-rw-rw---- 1 mysql mysql 5242880 Dec 27 17:55 ib_logfile1

-rw-rw---- 1 mysql mysql 588M Mar 12 02:03 maria_log.00000003

-rw-rw---- 1 mysql mysql 52 Mar 12 01:54 maria_log_control

drwx------ 2 mysql root 4.0K Jan 15 14:28 mysql

-rw-rw---- 1 mysql mysql 20K Dec 27 17:54 mysqld-bin.000001

-rw-rw---- 1 mysql mysql 715K Dec 27 17:54 mysqld-bin.000002

-rw-rw---- 1 mysql mysql 625 Dec 28 11:46 mysqld-bin.000003

-rw-rw---- 1 mysql mysql 125 Dec 27 18:20 mysqld-bin.000004

-rw-rw---- 1 mysql mysql 125 Dec 27 18:20 mysqld-bin.000005

-rw-rw---- 1 mysql mysql 125 Dec 27 18:21 mysqld-bin.000006

-rw-rw---- 1 mysql mysql 125 Dec 27 18:21 mysqld-bin.000007

-rw-rw---- 1 mysql mysql 125 Dec 27 18:22 mysqld-bin.000008

-rw-rw---- 1 mysql mysql 125 Dec 27 18:22 mysqld-bin.000009

-rw-rw---- 1 mysql mysql 20K Dec 27 18:22 mysqld-bin.000010

-rw-rw---- 1 mysql mysql 715K Dec 27 18:22 mysqld-bin.000011

-rw-rw---- 1 mysql mysql 125 Dec 27 18:24 mysqld-bin.000012

-rw-rw---- 1 mysql mysql 125 Dec 27 18:25 mysqld-bin.000013

-rw-rw---- 1 mysql mysql 125 Dec 27 18:27 mysqld-bin.000014

-rw-rw---- 1 mysql mysql 125 Dec 28 09:55 mysqld-bin.000015

-rw-rw---- 1 mysql mysql 125 Dec 28 11:41 mysqld-bin.000016

-rw-rw---- 1 mysql mysql 125 Dec 28 11:42 mysqld-bin.000017

-rw-rw---- 1 mysql mysql 125 Dec 28 12:07 mysqld-bin.000018

-rw-rw---- 1 mysql mysql 1.4K Dec 28 12:49 mysqld-bin.000019

-rw-rw---- 1 mysql mysql 125 Dec 28 16:31 mysqld-bin.000020

-rw-rw---- 1 mysql mysql 107M Dec 28 18:30 mysqld-bin.000021

-rw-rw---- 1 mysql mysql 1.2M Dec 30 09:22 mysqld-bin.000022

-rw-rw---- 1 mysql mysql 125 Dec 30 09:26 mysqld-bin.000023

-rw-rw---- 1 mysql mysql 3.8K Dec 30 12:29 mysqld-bin.000024

-rw-rw---- 1 mysql mysql 59M Jan 11 21:34 mysqld-bin.000025

-rw-rw---- 1 mysql mysql 10M Jan 14 15:16 mysqld-bin.000026

-rw-rw---- 1 mysql mysql 186K Jan 15 05:16 mysqld-bin.000027

-rw-rw---- 1 mysql mysql 21K Jan 15 14:46 mysqld-bin.000028

-rw-rw---- 1 mysql mysql 13K Jan 15 15:12 mysqld-bin.000029

-rw-rw---- 1 mysql mysql 62M Jan 17 16:36 mysqld-bin.000030

-rw-rw---- 1 mysql mysql 63M Jan 18 17:10 mysqld-bin.000031

-rw-rw---- 1 mysql mysql 125 Jan 18 17:16 mysqld-bin.000032

-rw-rw---- 1 mysql mysql 21K Jan 18 17:23 mysqld-bin.000033

-rw-rw---- 1 mysql mysql 118M Jan 22 12:41 mysqld-bin.000034

-rw-rw---- 1 mysql mysql 209K Jan 22 12:59 mysqld-bin.000035

-rw-rw---- 1 mysql mysql 117M Jan 28 11:59 mysqld-bin.000036

-rw-rw---- 1 mysql mysql 125 Jan 28 13:46 mysqld-bin.000037

-rw-rw---- 1 mysql mysql 24M Jan 28 16:01 mysqld-bin.000038

-rw-rw---- 1 mysql mysql 460K Jan 28 16:10 mysqld-bin.000039

-rw-rw---- 1 mysql mysql 7.0M Jan 28 16:52 mysqld-bin.000040

-rw-rw---- 1 mysql mysql 2.3M Jan 28 17:12 mysqld-bin.000041

-rw-rw---- 1 mysql mysql 2.1M Jan 28 17:27 mysqld-bin.000042

-rw-rw---- 1 mysql mysql 173K Jan 28 17:37 mysqld-bin.000043

-rw-rw---- 1 mysql mysql 378K Jan 28 17:44 mysqld-bin.000044

-rw-rw---- 1 mysql mysql 79K Jan 28 17:50 mysqld-bin.000045

-rw-rw---- 1 mysql mysql 272K Jan 28 18:12 mysqld-bin.000046

-rw-rw---- 1 mysql mysql 156K Jan 28 18:15 mysqld-bin.000047

-rw-rw---- 1 mysql mysql 962K Jan 28 18:33 mysqld-bin.000048

-rw-rw---- 1 mysql mysql 43K Jan 28 18:40 mysqld-bin.000049

-rw-rw---- 1 mysql mysql 28M Jan 29 11:43 mysqld-bin.000050

-rw-rw---- 1 mysql mysql 125 Jan 29 11:46 mysqld-bin.000051

-rw-rw---- 1 mysql mysql 139K Jan 29 12:37 mysqld-bin.000052

-rw-rw---- 1 mysql mysql 135K Jan 29 12:44 mysqld-bin.000053

-rw-rw---- 1 mysql mysql 409M Feb 9 23:18 mysqld-bin.000054

-rw-rw---- 1 mysql mysql 482M Feb 17 09:37 mysqld-bin.000055

-rw-rw---- 1 mysql mysql 542M Feb 27 12:30 mysqld-bin.000056

-rw-rw---- 1 mysql mysql 125 Feb 27 12:31 mysqld-bin.000057

-rw-rw---- 1 mysql mysql 125 Feb 27 14:48 mysqld-bin.000058

-rw-rw---- 1 mysql mysql 854M Mar 13 12:08 mysqld-bin.000059

-rw-rw---- 1 mysql mysql 1.1K Feb 27 14:49 mysqld-bin.index

Jesus Christ, what are these logs and bins? Finally found information:

mysql-bin. 00001, mysql-bin.000002 and other files are operation logs of, for example, UPDATE a table, or Delete some data, even if the statement does not match the data, this command will be stored in the log file, including the execution time of each statement, will also be recorded. This is mainly used for operational review and multi-database synchronization. ib_logfile is used to record the consistency of InnoDB tables and can only be used after the machine is down. maria_log.0000003 is a MariaDB file used by Bill Cover, which has similar functions.

But for Bill Lid, there was no master-slave database, no censorship, and these files were completely useless! First, clean up those files. Then edit the configuration file, organize it to record these logs, and remove the weeds. Gentoo's MySQL logs are located in/etc/mysql/my.cnf. Comment out the log-bin line.

Then restart MySQL server, problem solved! Free space instantly increased by GB!

"How to solve the problem of"mysql-bin.000001"occupying a large space" is introduced here. Thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report