Nov 1, 2018

How to get the latest MySQL binary log position When Setting Up a New Replication Slave

See also: How to Obtain MySQL Replication Master Binary Log Coordinates

Start the new slave mysqld (version >= 5.1). It prints the latest MySQL binary log position the backup knows of.


InnoDB: Last MySQL binlog file position 0 128760128, file name ./hundin-bin.006


Note that InnoDB only stores the binary log position information to its tablespace at a transaction commit. To make InnoDB aware of the current binary log position, you must run at least one transaction while binary logging is enabled.

If MySQL Enterprise Backup (MEB) Reports the Binary Log Position As 18446744073709551615 or -1, such as:


mysqlbackup: INFO: Last MySQL binlog file position 0 18446744073709551615, file name mysql-bin.000850:-1

It is because when creating a backup where the backup was created in one of the following ways:

then the binary log position is reported either as 18446744073709551615 or -1.

Use the CHANGE MASTER SQL command on the slave to initialize it properly. For example:

CHANGE MASTER TO
MASTER_LOG_FILE='hundin-bin.006',
MASTER_LOG_POS=128760128;