Can expire_logs_days be less than 1 day in MySQL?

Experimenting was the order of the evening...

mysql> set @@global.expire_logs_days=0.75;
ERROR 1232 (42000): Incorrect argument type to variable 'expire_logs_days'
mysql> set @@global.expire_logs_days=.75;
ERROR 1232 (42000): Incorrect argument type to variable 'expire_logs_days'
mysql> set @@global.expire_logs_days=3.4;
ERROR 1232 (42000): Incorrect argument type to variable 'expire_logs_days'
mysql> set @@global.expire_logs_days=3/4;
ERROR 1232 (42000): Incorrect argument type to variable 'expire_logs_days'
mysql> set @@global.expire_logs_days=F;
ERROR 1232 (42000): Incorrect argument type to variable 'expire_logs_days'
mysql> set @@global.expire_logs_days=0xF;
ERROR 1232 (42000): Incorrect argument type to variable 'expire_logs_days'
mysql> set @@global.expire_logs_days=1;
Query OK, 0 rows affected (0.00 sec)

Actually, there is a way to emulate it.

Here are the steps to purge binary logs to 1 hour.

STEP 01) Create an SQL script that will delete all binary logs whose timestamp is older than an hour:

echo "FLUSH LOGS;" > /usr/bin/purge.sql
echo "PURGE BINARY LOGS BEFORE NOW() - INTERVAL 1 HOUR;" >> /usr/bin/purge.sql

STEP 02) Create a shell script (/usr/bin/purge.sh) to call mysql with purge.sql

mysql -uroot -p... < /usr/bin/purge.sql

STEP 03) Make /usr/bin/purge.sh executable

chmod +x /usr/bin/purge.sh

STEP 04) Add usr/bin/purge.sh to the crontab to kick off every hour

0 * * * * /usr/bin/purge.sh

Give it a Try !!!


That page does say the range is 0-99.. so yeah, it is an integer.

0 = No expire..

You have got me wondering what 0.5 would do.. I'm thinking it would ignore the .5 part and just not expire them..