What causes the MySQL error 1062 – duplicate entry when starting slave?

What to try to fix your problem:

  1. You should remove master.info on slave first and restart mysql
  2. issue CHANGE MASTER TO MASTER_HOST=’XX.XX.XX.XX’, MASTER_USER=’repl’, MASTER_PASSWORD=’slavepass’;
  3. do mysqldump with ‘–flush-logs’ option on master
  4. ‘mysql -u user -p < dump.sql’ on slave
  5. ‘show slave status\G’ on slave to ensure that it is properly configured, MASTER_LOG_POS is 0
  6. ‘start slave;’ on slave.

What to check also:

  • Binlog format: MIXED
  • server_ids are different on master and slave

Leave a Comment