MySQL – Limit bin files to keep only 3 days

1. If Data folder of your MySQL server is being filled with many -bin files:

2. Open File Explorer -> Go to: C:\ProgramData\MySQL\MySQL Server 8.0

Edit my.ini with notepad (as admin)

3. Find [mysqld] -> From there go down to the bottom

4. Add this new value:

binlog_expire_logs_seconds = 259200

5. Go to Services (as admin) -> Restart MySQL service.

6. Wait until restart is finishing -> Then go to: C:\ProgramData\MySQL\MySQL Server 8.0\Data

Ensure old -bin files more than 3 days were deleted and you see only the recent ones.


Enjoy 🙂