How to purge logs in MYSQL

1.Login as root or admin privileged user

$ mysql -u root -p password

2. Purge the Logs with log number

test$ PURGE BINARY LOGS TO “mysql-bin.0900”
The above command will purge all logs before 0900 and keep the logs 900 and above

3. Purge the logs until specific date and time

test$ PURGE BINARY LOGS BEFORE “2009-09-02 22:00:00”;
This command will purge the logs before 2nd Sep 22:00 Hrs

Leave a Reply