Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 218
Jake Armstrong Avatar asked Aug 19 '12 08:08

Jake Armstrong


People also ask

How do I read MySQL bin logs?

You can use mysqlbinlog to read binary log files directly and apply them to the local MySQL server. You can also read binary logs from a remote server by using the --read-from-remote-server option. To read remote binary logs, the connection parameter options can be given to indicate how to connect to the server.

What is MySQL Binlog dump?

binlog dump is a thread on a master server for sending binary log contents to a slave server. If need more information on different values of Command you can refer to: http://dev.mysql.com/doc/refman/5.1/en/thread-commands.html.

What is Dumpfile in MySQL?

INTO DUMPFILE is a SELECT clause which writes the resultset into a single unformatted row, without any separators, in a file. The results will not be returned to the client. file_path can be an absolute path, or a relative path starting from the data directory.

Where does MySQL store dump file?

By default it does it to the working directory at the time the command was made. You need to redirect the output to a file if you need to save it.


1 Answers

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...

like image 154
Jake Armstrong Avatar answered Sep 28 '22 00:09

Jake Armstrong