Not the answer you need?
Register and ask your own question!

Clarification on Mysql dynamic variable "expire_logs_days"

krishnakrishna ContributorInactive User Role Beginner
We have Mysql running 5.5.25 and "expire_logs_days" is by default '0'. We have purged the logs using the command
PURGE BINARY LOGS TO 'mysql-bin.xxxxxx';. Plan to enable auto purge of mysql bin logs so I set the variable to retain the last 14 days logs as SET GLOBAL expire_logs_days=14. My question is do we need to add this parameter expire_logs_days in my.cnf, if so why? Having said that it is a global parameter it does not require to be added in my.cnf. If it is mandatory to add in my.cnf, do we need to restart the mysql instance to have the changes affective or just add in my.cnf and also set in variables without restarting the instance. Please suggest!!


  • mirfanmirfan Database Administrator Inactive User Role Beginner
    expire_logs_days is dynamic variable and it's value can be set without restarting MySQL however, if server restarts expire_log_days value will be reset and your changes will be lost. In order to make change permanent you can also add it in my.cnf and whenever mysql restarts it value will be persist which you already set previously without restarting via SET GLOBAL expire_log_days=14 You can read more about it here

    Hope that helps.
  • krishnakrishna Contributor Inactive User Role Beginner
    Thanks for clarifying Irfan.
Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.