Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top


Will it re-create?

share|improve this question

migrated from Dec 15 '09 at 1:00

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

Why not just rename the file and see what happens? – Steven Dec 14 '09 at 23:56
The world will implode – Mark Henderson Dec 15 '09 at 3:15

If you just move/remove it, you will probably be stuck with an open file handle that keeps getting written to, but you will no longer see the file.

This is a binary log, which is used for replication, and you can also use them for things like incremental backups as it keeps a history of all transactions.

If you don't want the file there, you have to comment out the my.cnf line that says


Then restart (or reload) MySQL. As long as it isn't actively using it, you are then safe to remove it.

share|improve this answer

mysql-bin.log or whatever it is called contains data necessary for replication or recovery. If you are not using replication and your database is intact, you (probably) won't need it and if you remove it and restart mysql it will start filling up again from that point on (without magically restoring the deleted logs, of course).

From the docs,

The binary log contains all statements that update data or potentially could have updated it [...] The binary log has two important purposes:

  • For replication, the binary log is used on master replication servers as a record of the statements to be sent to slave servers.[...]

  • Certain data recovery operations require use of the binary log. [...]


If you are using replication, you should not delete old binary log files on the master until you are sure that no slave still needs to use them.

Read the documentation yourself before proceeding.

share|improve this answer

It will disappear, and MySQL will probably report errors. It will appear again when you restart MySQL.

If you doesn't use mySQL replication it's safe to turn off binary logs: A client that has the SUPER privilege can disable binary logging of its own statements by using a SET sql_log_bin=0 statement.

share|improve this answer

Your Answer


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.