Mysql 'bin' logs?

Posted on 2004-11-04
Last Modified: 2008-02-07
This should be a fairly simple question...

I have a huge amount of 'hostname-bin.001' to 'hostname-bin.NNN' style logs in my mysql directory.

My question is,

A: What are these logs good for?
B: If I'm making regular (hourly) backups of my databases anyway via another system, are these useless?
C: Is there a way to turn off these logs?

Many thanks,
Question by:umbrae
    LVL 8

    Accepted Solution

    Extracted from
    Stop mysqld if it's running, then start it with the --log-bin[=file_name] option. See section 5.9.4 The Binary Log. The binary log files provide you with the information you need to replicate changes to the database that are made subsequent to the point at which you executed mysqldump.

    Even if you are doing an hourly backup, the binary log is still important. Every time you do a backup, you should take note of the point of the binary log. Easier to do a FLUSH LOGS and take note of the next binary log filename.

    In a crash, after you restore from your backup, you can replay the binary logs after the backup to obtain an up-to-date (till the state before the crash). You will need a backup and the binary logs to do a restore without losing too much data.
    If you have the binary logs in a separate disk from your database tables, maybe you do not need to backup as frequent as hourly, maybe daily will do.

    Old binary logs of course can be deleted when no longer needed. Just keep the binary log since the previous 2 or 3 backups will be sufficient. Or, you can archive them together with your backup if you want.

    LVL 26

    Expert Comment


    [Taken from NET & might be identical to above comment..]

    The binary log is primarily there to let you restore data. Say you backup
    every night at 04:00 and your database crashes at 15:00 you can restore from
    your backup but what about all those changes in the 11 hours after the
    backup was made?

    Instead you can use mysqlbinlog to run all the changes made in those 11
    hours and get your data back to pretty much exactly where it was before the

    According to the manual, the performance hit is about 1% - that's peanuts in
    exchange for the ability to recover your data.

    The other function of the binary log is to store statements that will be
    replicated on slave servers. That might not be relevant to you at the
    moment, but will perhaps be something you need later?

    If you really want to disable it, read the manual page at:

    LVL 26

    Expert Comment

    it was late.. sorry..

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Loading csv or delimited data files to MySQL database is a very common task frequently questioned about and almost every time LOAD DATA INFILE comes to the rescue. Here we will try to understand some of the very common scenarios for loading data …
    Both Easy and Powerful How easy is PHP? (  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now