Created
August 20, 2024 08:41
-
-
Save dharma017/451354f48aa3ad006ac3e30690b36c79 to your computer and use it in GitHub Desktop.
Delete MySql Log File
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Erase all binary logs before midnight 3 days ago. | |
PURGE BINARY LOGS BEFORE DATE(NOW() - INTERVAL 3 DAY) + INTERVAL 0 SECOND; | |
If you want to have binlog rotated away automatically and keep 3 days worth, simply set this: | |
mysql> SET GLOBAL expire_logs_days = 3; | |
then add this to /etc/my.cnf | |
[mysqld] | |
expire_logs_days=3 | |
and mysqld will delete them logs for you | |
Updated way: | |
touch /etc/mysql/mysql.conf.d/binlog_expiration.cnf | |
Add following content in binlog_expiration.cnf file | |
[mysqld] | |
# Three days: 24*60*60*3 | |
#binlog_expire_logs_seconds=259200 | |
skip-log-bin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment