3

info: my tables are all innodb.

i know i can create a mysql slave by copying the data from master to slave and noting the position in the binlog and set that on the slave. thus the slave should be able to replay all master binlog entries since the backup and sync that way.

but, in case the binlog exists from the start, can i simply set the binlog position on the slave to 0, thus not having to copy any data and just have the slave catch up to the most recent binlog entry?

2 Answers 2

2

That could work if

  • You loaded data in an empty MySQL instance
  • You had binary logging enabled from the start
  • You never erased any of your binary logs

There is one catch: There is no literal position 0.

There is a different position 0 for different versions of MySQL

  • position 107 (MySQL 5.5)
  • position 106 (MySQL 5.1)
  • position 98 (MySQL 5.0 and prior)

I wrote about this a long time ago in the DBA StackExchange:

If you do not have every binary log since the inception of the MySQL Data Load, you could make a copy using rsync and one restart of mysql:

1
  • 120 in MySQL 5.6 just in case anyone is looking for this.
    – Carson Ip
    Aug 13, 2018 at 9:29
0

If you really have all the binlogs, and the database set up correctly, I can't think of any technical reason why not. The entire reason behind the binlog is to allow this sort of thing.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .