How to fix “error no 1062” in MySQL servers
Last_Errno: 1062
Last_Error: Error 'Duplicate entry '1246' for key 'PRIMARY'' on query. Default database: 'mamc'. Query: 'INSERT INTO transque (clipid, ext, sourcedeviceid, destinationdeviceid, requesttime, userid, sourcedir,exitcode, destinationdir, userremarks)
VALUES ('ZWB81670', '.mxf', '229', '158', NOW(), '35', '\\\\172.18.1.10\\mg1\\SONY-CONTENT\\HD\\PROMOS\\MAX\\INDIA\\15-05-20\\File 2','MANUAL', '\\\\172.17.1.196\\Fc Server\\15-05-20', '')'
Last_Error: Error 'Duplicate entry '1246' for key 'PRIMARY'' on query. Default database: 'mamc'. Query: 'INSERT INTO transque (clipid, ext, sourcedeviceid, destinationdeviceid, requesttime, userid, sourcedir,exitcode, destinationdir, userremarks)
VALUES ('ZWB81670', '.mxf', '229', '158', NOW(), '35', '\\\\172.18.1.10\\mg1\\SONY-CONTENT\\HD\\PROMOS\\MAX\\INDIA\\15-05-20\\File 2','MANUAL', '\\\\172.17.1.196\\Fc Server\\15-05-20', '')'
How to delete the row
First delete the row using the primary key.
delete from table1 where field1 is key1;
Then stop and start the slave:
stop slave;
start slave;
select sleep(5);
Once it is done, check the slave status to see if replication is continuing.
show slave status;
If all is well, you’ll see “Seconds_Behind_Master” as a number. If not, your replication is broken and it needs to be fixed.
How to skip the row
For this, you can set the Skip counter to 1.
Here’s how it could look like:
stop slave;
set global SQL_SLAVE_SKIP_COUNTER = 1;
start slave;
select sleep(5);
Then check the slave status to see if replication is continuing.
show slave status;
Again, if all is well, you’ll see “Seconds_Behind_Master” as a number. If not, your replication is broken and it needs to be fixed.
Note=This command is used for mysql 5.7 above version
Comments
Post a Comment