Ways to clear the MySQL log

Source: Internet
Author: User

[Root@aslibra www.aslibra.com]# mysql-s/data/www.aslibra.com/mysql/mysql.sock-uadmin-ppassword
Welcome to the MySQL Monitor. Commands End With; or G.
Your MySQL Connection ID is 322891
Server Version:5.5.2-m2-log Source Distribution

Type ' help, ' or ' h ' for help. Type ' C ' to clear the current input statement.

#显示当前所有日志

The code is as follows Copy Code
Mysql> show master logs;

+------------------+------------+
| Log_name | File_size |
+------------------+------------+
|        mysql-bin.000001 | 126 |
| mysql-bin.000002 | 1074328576 |
|  mysql-bin.000003 | 918443740 |
|        mysql-bin.000004 | 126 |
|        mysql-bin.000005 | 126 |
|  mysql-bin.000006 | 109880744 |
+------------------+------------+
6 rows in Set (0.00 sec)

#删除日志到某一个, not more than the last

The code is as follows Copy Code
Mysql> purge master logs to ' mysql-bin.000027 ';

ERROR 1373 (HY000): Target log not found in Binlog index

#删除日志到最后一个即可

The code is as follows Copy Code
Mysql> purge master logs to ' mysql-bin.000006 ';

Query OK, 0 rows affected (3.80 sec)

#看看现在的情况

The code is as follows Copy Code
Mysql> show master logs;

+------------------+-----------+
| Log_name | File_size |
+------------------+-----------+
| mysql-bin.000006 | 109884395 |
+------------------+-----------+
1 row in Set (0.00 sec)

#退出

The code is as follows Copy Code
Mysql> exit

Related Article

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.