[root@oa1db oadata]# pwd
/dbdata/oadata
[root@oa1db oadata]# du -m mysql-bin.000418
1026 mysql-bin.000418
登录库
mysql -u root -pxxxxx
mysql> show binary logs;
...........................................................
| mysql-bin.000563 | 1073916143 |
| mysql-bin.0005 | 1074472268 |
| mysql-bin.000565 | 810491102 |
+------------------+------------+
565 rows in set (0.00 sec)
mysql> select CURRENT_DATE;
+--------------+
| CURRENT_DATE |
+--------------+
| 2016-06-27 |
+--------------+
1 row in set (0.01 sec)
mysql> PURGE MASTER LOGS BEFORE DATE_SUB(CURRENT_DATE, INTERVAL 10 DAY);
Query OK, 0 rows affected (13.40 sec)
mysql> SHOW master logs;
............................................
| mysql-bin.0005 | 1074472268 |
| mysql-bin.000565 | 810510482 |
+------------------+------------+
42 rows in set (0.00 sec)
磁盘空间被大量的释放出来!