Mysql – Broken thesql replication on slave server (error 1236)

MySQLreplication

My question is: how to fix broken mysql replication on slave server (error 1236)?

server 1 (192.168.1.105)
server 2 (192.168.1.106)

I ran these steps to re-sync:

At the master – server 1 (192.168.1.105):

mysql -u root -p
  1. RESET MASTER;
  2. FLUSH TABLES WITH READ LOCK;
  3. SHOW MASTER STATUS;
  4. Note > File: mysql-bin.000001 and Position: 107
  5. mysqldump -uroot -p --events --ignore-table=mysql.events --all-databases > /var/backups/mysqldump.sql
  6. UNLOCK TABLES;
  7. Copy mysql dump file to server 2
    (scp -p /var/backups/mysqldump.sql root@192.168.1.106:/tmp)

At the slave server 1 (192.168.1.106):

  1. STOP SLAVE;
  2. mysql -uroot -p < /tmp/mysqldump.sql
  3. RESET SLAVE;
  4. CHANGE MASTER TO MASTER_HOST='192.168.1.105', MASTER_USER='slaveuser', MASTER_PASSWORD='mypassword';
  5. CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=107;
  6. START SLAVE;

I still got this error on server 1

Last_IO_Errno: 1236 Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file'

Best Answer

I believe the log file and position need to be specified with the host.

Try:

CHANGE MASTER TO MASTER_HOST='192.168.1.105', MASTER_USER='slaveuser', MASTER_PASSWORD='mypassword', MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=107;