2

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?

RolandoMySQLDBA
  • 16,364
  • 3
  • 47
  • 80
david
  • 21
  • 2

2 Answers2

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:

RolandoMySQLDBA
  • 16,364
  • 3
  • 47
  • 80
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.

NickW
  • 10,183
  • 1
  • 18
  • 26