MySQL replication stop at Last Errno 1062


mysql, mysql databaseI just setup a MySQL replication at 2 virtual machine. However today i found the replication stop at the slave machine with last_errno 1062. With the error message:-

“Error ‘Duplicate entry ‘2562846’ for key 1′ on query. Default database: …”

My system admin told me that they restarted my machine last nite and i think that cause the mysql replication stop.

How to solve MySQL replication stop at last errno 1062:-

Advertisements

  • Login to your MySQL thru ssh
  • if you know it is caused by one duplicate record then you can use the command below to solve the problem:-
      mysql> SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; 
    mysql> START SLAVE;

    then you may check the mysql slave status thru the command below:-

    mysql> show slave status\G;

    * You may change the value of SQL_SLAVE_SKIP_COUNTER to skip the total no. of record.

  • If you know that skipping all this Error no 1062 will not affect your data integrity, then you can configure to skip all error no 1062 in your my.cnf file.
    just add the line below and restart your mysql server:-

    slave-skip-errors = 1062

    remember to start your slave again.




Share this with your friends:-

Leave a Reply