MySQL Components As mentioned previously, flushing the binary log creates a new binary log file, whereas flushing the general query log, slow query log, or error log just closes and reopens the log file. For the latter logs, to cause a new log file to be created on Unix, rename the current log file first before flushing it. At flush time, the server opens the new log file with the original name. For example, if the general query log, slow query log, and error log files are named  mysql.log ,  mysql-slow.log , and  err.log , you can use a series of commands like this from the command line: At this point, you can make a backup of  mysql.log.old ,  mysql-slow.log.old , and  err.log.old , then remove them from disk. To rename the general query log or slow query log at runtime, first connect to the server and disable the log: With the logs disabled, rename the log files externally (for example, from the command line). Then enable the logs again: This method works on any platform and does not require a server restart. For the server to recreate a given log file after you have renamed the file externally, the file location must be writable by the server. This may not always be the case. For example, on Linux, the server might write the error log as  /var/log/ mysqld.log , where  /var/log  is owned by  root  and not writable by  mysqld . In this case, log-flushing operations fail to create a new log file. MySQL Server includes a component-based infrastructure for extending server capabilities. A component provides services that are available to the server and other components. (With respect to service use, the server is a component, equal to other components.) Components interact with each other only through the services they provide. MySQL distributions include several components that implement server extensions: •Components for configuring error logging. See Section 5.4.2, “The Error Log” , and Section 5.5.3, “Error Log Components” . 1068 5.5 MySQL Components Note cd  mysql-data-directory mv mysql.log mysql.log.old mv mysql-slow.log mysql-slow.log.old mv err.log err.log.old mysqladmin flush-logs SET GLOBAL general_log = ’OFF’; SET GLOBAL slow_query_log = ’OFF’; On Windows, use  rename  rather than  mv . SET GLOBAL general_log = ’ON’; SET GLOBAL slow_query_log = ’ON’; mv /var/log/mysqld.log /var/log/mysqld.log.old install -omysql -gmysql -m0644 /dev/null /var/log/mysqld.log To handle this situation, you must manually create the new log file with the proper ownership after renaming the original log file. For example, execute these commands as  root :