Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Limiting mysql log file size

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

like image 905
Gregg Horton Avatar asked Nov 28 '12 20:11

Gregg Horton


People also ask

Does log file have limit?

The limiting factor for log files on a storage media is the currently available free storage size and not how old a log file is or how old its entries are.

What is a reasonable log file size?

A good STARTING POINT for your log file is twice the size of the largest index in your database, or 25% of the database size.

Does MySQL have a size limit?

You are using a MyISAM table and the space required for the table exceeds what is permitted by the internal pointer size. MyISAM permits data and index files to grow up to 256TB by default, but this limit can be changed up to the maximum permissible size of 65,536TB (2567 − 1 bytes).


1 Answers

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.

like image 124
echo_Me Avatar answered Oct 13 '22 14:10

echo_Me