How to change the expiration date of binlog files?
How to change the expiration date of binlog files ?


To purge binary logs prior to a binary log file or prior to a particular date, use purge binary logs statement.

To set an expiration period for binary logs, use binlog_expire_logs_seconds. I would recommend to keep this more than 2 days, whether or not you have replication enabled.


  I can not find the file to configure.


To see the order in which MySQL looks at the configuration files, run the following:

mysqld --help --verbose | grep -A 2 "Default options are read from"


If you also want to see what values the different variables would take on start, remove the grep part.

For a variable whose value is specified multiple times in the configuration files, or multiple times in the same file, the last value would be considered by MySQL. Some of these configuration files may not already be present, in which case you can create them on your own, and under [mysqld] in the configuration file, add the parameters you want to set.


  Is it safe for the database to change the timeout ?


Yes, it is safe if there is no replication involved. Even if a slave does exist, if all the logs that are to be deleted have been already processed and executed by the slave, it is safe to delete those logs from master.