GNU Info

Info Node: (mysql.info)Log file maintenance

(mysql.info)Log file maintenance


Prev: Slow query log Up: Log Files
Enter node , (file) or (file)node

Log File Maintenance
--------------------

MySQL has a lot of log files which make it easy to see what is going.
Note: Log Files. One must however from time to time clean up after
`MysQL' to ensure that the logs don't take up too much disk space.

When using MySQL with log files, you will, from time to time, want to
remove/backup old log files and tell MySQL to start logging on new
files.  Note: Backup.

On a Linux (`Redhat') 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.  Note that you should
be careful with this if you are using the log for replication!

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 command `FLUSH LOGS'.  If you are using
MySQL Version 3.21 you must use `mysqladmin refresh'.

The above command 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') is used, closes the update log
     and opens a new log file with a higher sequence number.

If you are using only an update log, you only have to flush the logs
and then move away the old update log files to a backup.  If you are
using the normal logging, you can do something like:

     shell> cd mysql-data-directory
     shell> mv mysql.log mysql.old
     shell> mysqladmin flush-logs

and then take a backup and remove `mysql.old'.


automatically generated by info2www version 1.2.2.9