Server Log Maintenance
- The MySQL Server can create a number of different log files that make it easy to see what is going on.
- Log files must be cleaned up regularly to ensure the logs do not take up too much disk space.
- The requires one to back up and remove old log files from time to time.
- On Linux, use the
mysql-log-rotate script for rotating logs and log clean up.
- If MySQL is installed from a RPM distribution, the
mysql-log-rotate script should have been installed automatically.
- For the binary log, set the
expire_logs_days system variable to expire binary log files automatically after a given number of days.
- For replication, set the variable no lower than the maximum number of days the slaves might lag behind the master.
- There are three ways to force MySQL to start using new log files.
- Issue a
FLUSH LOGS statement
- Run
mysqladmin flush-logs
- Run
mysqladmin refresh
Let us review the chapter.
© 2007 John Michael Pierobon
Notes