DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(mysql.info) log-file-maintenance

Info Catalog (mysql.info) slow-query-log (mysql.info) log-files
 
 5.12.5 Server Log Maintenance
 -----------------------------
 
 MySQL Server can create a number of different log files that make it
 easy to see what is going on. See  log-files. However, you must
 clean up these files regularly to ensure that the logs do not take up
 too much disk space.
 
 When using MySQL with logging enabled, you may want to back up and
 remove old log files from time to time and tell MySQL to start logging
 to new files. See  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, this
 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' (or its equivalent) for handling 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'.
 
 A log flushing operation does the following:
 
    * If general query logging (-log) or slow query logging
      (-log-slow-queries) is used, the server closes and reopens the
      general query log file or slow query log file.
 
    * If binary logging (-log-bin) is used, the server closes the
      current log file and opens a new log file with the next sequence
      number.
 
 The server creates a new binary log file when you flush the logs.
 However, it just closes and reopens the general and slow query log
 files. To cause new files to be created on Unix, rename the current
 logs before flushing them. At flush time, the server will open new logs
 with the original names. For example, if the general and slow query
 logs are named `mysql.log' and `mysql-slow.log', you can use a series of
 commands like this:
 
      shell> cd MYSQL-DATA-DIRECTORY
      shell> mv mysql.log mysql.old
      shell> mv mysql-slow.log mysql-slow.old
      shell> mysqladmin flush-logs
 
 At this point, you can make a backup of `mysql.old' and
 `mysql-slow.log' and then remove them from disk.
 
 On Windows, you cannot rename log files while the server has them open.
 You must stop the server and rename them, and then restart the server
 to create new logs.
 
Info Catalog (mysql.info) slow-query-log (mysql.info) log-files
automatically generated byinfo2html