I do apologize if this has been asked before but my search skills were not able to turn up a definitive answer.

SITUATION: I have two Windows Server 2012 R2 servers running WAMP 3.06 (which contains MySQL 5.7.14). They are setup for replication with a master-slave configuration using binary logging. I have a PowerShell script that makes a dump of the database each night. The PowerShell code looks like this...

# Variables
. (Join-Path $PSSCriptRoot MySQL_Vars.ps1)

# Backup the database
cmd /C " `"$mysqlDump`" $mysqlRoutineFlags -u $mysqlUser -p`"$mysqlPass`" $mysqlDB > $mysqlBkp"

QUESTION: How could I do this so that when the MySQL dump occurs, it is not written to the binary logs?

Thank you in advance for your help!

  • binlogging on Master? Or on Slave? If you turn it off on the Master, but continue writing to the Master, the Slave will be out of sync with no easy way to get it back in sync.
    – Rick James
    Commented Nov 21, 2017 at 19:37
  • @RickJames I can do it on either, though I would prefer to do it on Master. Is there a way to suspend bin logging for a specific session? Commented Nov 21, 2017 at 20:51

1 Answer 1


Only "writes" go to the binlog. A backup only does "reads".

Hence "How ... when the MySQL dump occurs, it is not written to the binary logs?" is a non-issue.

(Or, do I not understand the perceived problem??)

  • I guess I'm confused then. When I ran the backup as a scheduled task at night, I would notice that the bin logs were filling up. This database is not publicly accessible so nothing should be happening at night.I have since disabled the task and the bin logs have already rotated so I don't have a bin log to inspect. Commented Nov 22, 2017 at 14:07
  • 1
    The binlogs rotate when (1) they hit the max (1G or 100M or whatever), or (2) FLUSH LOGS is executed, or (3) mysqld is restarted. Look at the time on the remaining log; determine which case happened then.
    – Rick James
    Commented Nov 22, 2017 at 18:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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