MySQL - Is there a way to include the bin log position in the dump file without scripting

Jake Armstrong picture Jake Armstrong · Aug 19, 2012 · Viewed 7.4k times · Source

Is there a way to include the replication bin log position in the dump file without scripting?

I know there are ways through scripting, appending a line to the dump file etc. But I remember once reading that it's possible through a simple argument in mysqldump, is that true and if yes what's the syntax?

Thanks a lot

Answer

Jake Armstrong picture Jake Armstrong · Aug 19, 2012

Great, I've found the answer:

the --master-data option allows this

mysqldump --master-data=1 ... needs to be run on the master and will include a sql that will change the MySQL instance's master to the current file/log position automatically.

if 2 is used instead of 1 then it only writes a comment, which is also useful for manual setups...