MySQL error code 1062. Slave Duplicate entry, skip error

We will see the MySQL error code 1062 which is also known as “MySQL slave Duplicate entry” and we will see the MySQL error code 1054. Now we will skip the MySQL slave error

mysql error code 1062, mysql slave duplicate entry, mysql slave skip errors.

MySQL ERROR: 2020-03-22 14:43:43 28065 [Warning] Slave: Duplicate entry ‘1234’ for key ‘PRIMARY’ Error_code: 1062
2020-03-22 14:43:43 28065 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with “SLAVE START”. We stopped at log ‘mysql-bin-changelog.000015’ position 124752018.

The scenario was like have successfully established the MySQL Master and Slave Connection, and got the error like “MySQL slave duplicate entry with MySQL error code 1062”

We take a dump from the Master database, there is the possibility that our Master Server has duplicate entries, but it won’t work in the slave.

So we have just made the one change in the configuration file of MySQLmy.cnf“.

#vim /etc/my.cnf

[mysqld]

slave-skip-errors=1062
skip-slave-start

Save and quit the file by using :wq and then restart the service by using the following command

#sudo service mysql restart

So this means that if the slave host returns the error code 1062 then just skip that query.

That means MySQL slave skip the error or MySQL slave skip the duplicate entry.

Suppose you have to skip the two error codes then you have to use a comma and the error code in the configuration file and restart the MySQL service.

slave-skip-errors=1062, 1054

What is the MySQL error code 1054?

Suppose you insert the data into the table named as an example: tastethelinux>insert into example values(1,tastethelinux);

Now 1054 is one of the error code in the MySQL which means, there is Unknown column ‘tastethelinux’ in the field list

As you have seen that the above query contains the string “tastethelinux” because you have to use the single quotes like tastethelinux‘.

So the Correct Insert Query will be with single quotes as you can see below tastethelinux>insert into example values(1,'tastethelinux');

The solution for MySQL Error code 1298, Slave incorrect timezone. refers to the link.

Solution of MySQL error code 1594, Relay log read failure into the MySQL slave Server.

When the Master host will be changed then we have to follow the certain steps, so that the slave can reconnect with MySQL Master host.

To Upgrade the MySQL 5.5 to 5.7 in CentOS refer this link.

How to install MySQL 8 on Linux of any version on any flavour of the Linux refer this link.

If you want to learn Linux Basic command follow this link.

MySQL error code 1062, MySQL slave duplicate entry, MySQL slave skip the error, mysql slave skip duplicate entry, mysql slave ignore the error

Give your valuable time