The following describes how to clear mysql logs. I will not talk about it much below. I don't need to enclose it in the code box. It's just text. # The line is a real example of commenting on the following, for reference:
[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.
# Display all current logs
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)
# Delete a log to one, which cannot exceed the last one
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
# Delete the log to the last one.
The Code is as follows: |
Copy code |
Mysql> purge master logs to 'mysql-bin.000006 ';
|
Query OK, 0 rows affected (3.80 sec)
# Check the current situation
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)
# Exit
The Code is as follows: |
Copy code |
Mysql> exit |