Open Source · TechIt

Clearing the MySql Logs

Once in the MySQL console, you can use show and purge to selectively delete portions like below:

mysql> show master logs;

+------------------+------------+
| Log_name | File_size |
+------------------+------------+
| mysql-bin.000023 | 1074039776 |
| mysql-bin.000024 | 1023334365 |
| mysql-bin.000025 | 1073742100 |
| mysql-bin.000026 | 4254255 |
| mysql-bin.000027 | 117 |
| mysql-bin.000028 | 98 |
+------------------+------------+
6 rows in set (0.00 sec)

mysql> purge master logs to ‘mysql-bin.000028’;
Query OK, 0 rows affected (10.35 sec)

mysql> show master logs;
+——————+———–+
| Log_name | File_size |
+——————+———–+
| mysql-bin.000028 | 98 |
+——————+———–+
1 row in set (0.00 sec)

 

mysql>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s