Solve the problem that mysql logs occupy hard disks and cannot be started

Source: Internet
Author: User

The linux server that has been running for four months and has not been stopped went on strike today. After looking for many reasons, I found that the disk was used up and df-h was used, du-h-max-depth = 1 one by one search, I found that it is the space occupied by the mysql/data/mysql-bin.0000X file, I deleted it directly with rm, as a result, the data on the station was lost. Fortunately, there was a backup. In retrospect, the method is incorrect. The correct method is found. I hope you will not take a detour.

Found so many mysql-bin.0000X files, what is this? It turns out this is the mysql operation log file. I only have dozens of M databases, and the operation log is 3 GB in size. How do I delete mysql-bin.0000X log files? Red indicates the input command. [root @ jiucool var] #/usr/local/mysql/bin/mysql-u root-p Enter password: (Enter the password) Welcome to the MySQL monitor. commands end with; or \ g. your MySQL connection id is 264001 Server version: 5.1.35-log Source distribution Type 'help; 'or' \ H' for help. type '\ C' to clear the current input statement. mysql> reset master; (clear log files) Query OK, 0 rows affected (8.51 sec) mysql> OK, let's check the mysql file. How much space does the folder occupy? [Root @ jiucool var] # du-h-max-depth = 1/usr/local/mysql/37 M/usr/local/mysql/var 70 M/usr/local/ mysql/mysql-test 15 M/usr/local/mysql/lib 448 K/usr/local/mysql/include 2.9 M/usr/local/mysql/share 7.6 M/usr/ local/mysql/libexec 17 M/usr/local/mysql/bin 11 M/usr/local/mysql/docs 2.9 M/usr/local/mysql/SQL-runtime 163 M/ usr/local/mysql/is ready, take a look, the entire mysql directory occupies 16 m size! OK, no problem, since the mysql-bin.0000X Log File occupies such a large space, the significance of existence is not particularly large, so we won't let it generate it. [Root @ jiucool var] # find/-name my. cnf found my. cnf is the mysql configuration file. Comment out log-bin = mysql-bin. # Replication Master Server (default) # binary logging is required for replication # log-bin = mysql-bin restart MySQL

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.