(mysql.info.gz) Log file maintenance
Info Catalog
(mysql.info.gz) Slow query log
(mysql.info.gz) Log Files
5.9.6 Log File Maintenance
--------------------------
The MySQL Server can create a number of different log files that make
it easy to see what is going on. Log Files. However, you must
clean up these files regularly to ensure that the logs don't take up
too much disk space.
When using MySQL with logging enabled, you will want to back up and
remove old log files from time to time and tell MySQL to start logging
to new files. Backup.
On a Linux (Red Hat) installation, you can use the `mysql-log-rotate'
script for this. If you installed MySQL from an RPM distribution, the
script should have been installed automatically. You should be careful
with this script if you are using the binary log for replication! (You
should not remove binary logs until you are certain that their contents
have been processed by all slaves.)
On other systems, you must install a short script yourself that you
start from `cron' to handle log files.
You can force MySQL to start using new log files by using `mysqladmin
flush-logs' or by using the SQL statement `FLUSH LOGS'. If you are
using MySQL 3.21, you must use `mysqladmin refresh'.
A log flushing operation does the following:
* If standard logging (`--log') or slow query logging
(`--log-slow-queries') is used, closes and reopens the log file
(`mysql.log' and ``hostname`-slow.log' as default).
* If update logging (`--log-update') or binary logging (`--log-bin')
is used, closes the log and opens a new log file with a higher
sequence number.
If you are using only an update log, you only have to rename the log
file and then flush the logs before making a backup. For example, you
can do something like this:
shell> cd mysql-data-directory
shell> mv mysql.log mysql.old
shell> mysqladmin flush-logs
Then make a backup and remove `mysql.old'.
Info Catalog
(mysql.info.gz) Slow query log
(mysql.info.gz) Log Files
automatically generated byinfo2html