If you flush the error log using a 如果使用FLUSH ERROR LOGS
or FLUSH LOGS
statment, or a mysqladmin flush-logs command, the server closes and reopens any error log file to which it is writing. FLUSH ERROR LOGS
或FLUSH LOGS
语句或mysqladmin flush-logs命令刷新错误日志,则服务器将关闭并重新打开正在写入的任何错误日志文件。To rename an error log file, do so manually before flushing. Flushing the logs then opens a new file with the original file name. 要重命名错误日志文件,请在刷新之前手动重命名。刷新日志,然后打开一个具有原始文件名的新文件。For example, assuming a log file name of 例如,假设日志文件名为
, use the following commands to rename the file and create a new one:host_name
.errhost_name.err
,请使用以下命令重命名该文件并创建一个新文件:
mvhost_name
.errhost_name
.err-old mysqladmin flush-logs mvhost_name
.err-oldbackup-directory
On Windows, use rename rather than mv.在Windows上,使用rename而不是mv。
If the location of the error log file is not writable by the server, the log-flushing operation fails to create a new log file. 如果服务器无法写入错误日志文件的位置,则日志刷新操作将无法创建新的日志文件。For example, on Linux, the server might write the error log to the 例如,在Linux上,服务器可能会将错误日志写入/var/log/mysqld.log
file, where the /var/log
directory is owned by root
and is not writable by mysqld. /var/log/mysqld.log
文件,其中/var/log
目录为root
所有,不可由mysqld写入。For information about handling this case, see Section 5.4.6, “Server Log Maintenance”.有关处理此情况的信息,请参阅第5.4.6节,“服务器日志维护”。
If the server is not writing to a named error log file, no error log file renaming occurs when the error log is flushed.如果服务器没有写入命名的错误日志文件,则刷新错误日志时不会重命名错误日志文件。