Limiting mysql log file size

Gregg Horton picture Gregg Horton · Nov 28, 2012 · Viewed 17.2k times · Source

I have a mysql log file that regularly goes over 30gb, this sucks when you realise that your server is full because of this file. I need a simple solution to limit this file to about 1gb, i don't need logs that run that long, and i'd rather avoid this problem in the future.

Any ideas? Thanks

Answer

echo_Me picture echo_Me · Nov 28, 2012

To specify it in the my.cnf file, backup your current my.cnf file (always recommended), stop slave, stop the MySQL server and place the following option:

   # relay log restrictions
   relay-log-space-limit=15G

Then save and quit the file and start MySQL. Unless you configured differently, MySQL will automatically start the slave thread.