How to clean old binary logs

Recently I had a problem with Disc space on my MythTV box. I found the the inary logs for MYSQL were over a gig in size. These are records of all database transactions. They wllo you to recreate the database if a backup is out of date, as you can replay all transactions. Anyway I was able to lose a lot of these, and regain disc space, without affecting safety.

mysql -u root --password mythconverg
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 53 to server version: 4.1.21-log

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql> show master logs;
+——————-+———–+
| Log_name | File_size |
+——————-+———–+
| mythtv-bin.000001 | 79 |
| mythtv-bin.000002 | 79 |
| mythtv-bin.000003 | 79 |
| mythtv-bin.000004 | 50504 |
| mythtv-bin.000005 | 2767417 |
| mythtv-bin.000006 | 42523 |
| mythtv-bin.000007 | 79 |
| mythtv-bin.000008 | 7099399 |
| mythtv-bin.000009 | 60102 |
| mythtv-bin.000010 | 23028247 |
| mythtv-bin.000011 | 13157557 |
| mythtv-bin.000012 | 3300816 |

mysql> purge master logs to ‘mythtv-bin.010’;

This entry was posted in Uncategorised and tagged . Bookmark the permalink.