Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. 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

I have multiple queries :

Till when does MySQL retain the binary logs ? What is the default setting ? When does it start logging ?

What does the number of the binary log file name suggest for example in mysql-bin.xxxxxx what does xxxxxx signify.

I have oldest file with name mysql-bin.000163 how can check whether this file was the first binary log file ?

mysql-bin.index contains :

share|improve this question

The number in the mysql-bin.nnnnnn filename is simply a sequence number. This gets updated every time a FLUSH LOGS is initiated, either manually or through predetermined means and is sequential (e.g. normally starts at 00001 and goes up).

The logs will be kept forever unless you specify an expiry. This should be done in your MySQL configuration:

You can also delete the binary logs manually within MySQL by using the command:


See details here

It is possible to delete the files manually (outside of MySQL) but NOT recommended.

See for details on the binary logging system.

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.