Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

A bit of information:

select current_user: 
root@127.0.0.1

show grants for current_user(): 
'GRANT ALL PRIVILEGES ON *.* TO 'root'@'127.0.0.1' IDENTIFIED BY PASSWORD 'omitted'

Service string:
"C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld-nt" --defaults-file="C:\Program Files\MySQL\MySQL Server 5.0\my.ini" MySQL

Basically, I do not see any new files. The two files (.log and server_name.log) continue to grow and no occurence of *-old show up.

What am I doing wrong?

share|improve this question

migrated from stackoverflow.com Aug 19 '11 at 4:00

This question came from our site for professional and enthusiast programmers.

1 Answer 1

up vote 1 down vote accepted

FLUSH LOGS in MySQL only affects binary logs.

According to this excerpt from the MySQL Docs:

Closes and reopens all log files. If binary logging is enabled, the sequence number of the binary log file is incremented by one relative to the previous file. On Unix, this is the same thing as sending a SIGHUP signal to the mysqld server (except on some Mac OS X 10.3 versions where mysqld ignores SIGHUP and SIGQUIT).

If you execute FLUSH LOGS and mysqld is writing the error log to a file (for example, if it was started with the --log-error option), log file renaming occurs as described in Section 5.2.1, “The Error Log”.

IMHO, as a MySQL DBA these past 7 years, I have personally NEVER SEEN this work on error logs, but only binary logs.

In the latest MySQL Docs concerning MySQL 5.5:

If you flush the logs using FLUSH LOGS or mysqladmin flush-logs and mysqld is writing the error log to a file (for example, if it was started with the --log-error option), the effect is version dependent:

As of MySQL 5.5.7, the server closes and reopens the log file. To rename the file, you can do so manually before flushing. Then flushing the logs reopens a new file with the original file name. For example, you can rename the file and create a new one using the following commands:

shell> mv host_name.err host_name.err-old
shell> mysqladmin flush-logs
shell> mv host_name.err-old backup-directory

On Windows, use rename rather than mv.

Prior to MySQL 5.5.7, the server renames the current log file with the suffix -old, then creates a new empty log file. Be aware that a second log-flushing operation thus causes the original error log file to be lost unless you save it under a different name. On Windows, you cannot rename the error log while the server has it open before MySQL 5.5.7. To avoid a restart, flush the logs first to cause the server to rename the original file and create a new one, then save the renamed file. That also works on Unix, or you can use the commands shown earlier.

No error log renaming occurs when the logs are flushed in any case if the server is not writing to a named file.

Again, I repeat, I have personally NEVER SEEN this work on error logs, but only binary logs.

My employer's clients have this bash scripted.

share|improve this answer
    
Thanks for confirming the need to script the backup! –  TekiusFanatikus Aug 21 '11 at 13:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.