'MySQL (1 Master, 1 Slave) Unable to Set Replication on Slave

I have a VM dedicated as mysql master and another VM dedicated as mysql slave.

I do not have any replication set yet on my slave (as you can see the output obtained on master mysql):

enter image description here

Now, i want to set replication on my dedicated slave VM so, I took a dump of all databases present on master with following command :

mysqldump -h <master_ip> -u <user_name> -p <password> --master-data --single-transaction --databases <data_base_names> > dump.sql

After taking the dump I executed following commands in order to set replication running on my slave:

// connect to db
STOP SLAVE;
RESET SLAVE ALL;
SOURCE <dump.sql file location>;
FLUSH LOGS;
CHANGE MASTER TO MASTER_HOST=<masterip>, MASTER_USER=<replication_user>, MASTER_PASSWORD=<password>, MASTER_LOG_FILE =<master_log_file>, MASTER_LOG_POS=<position>;
START SLAVE;
SHOW SLAVE STATUS;

Now that the replication should be started, when i looked at "SHOW SLAVE STATUS" output; I can see following errors one after the other (even after setting SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; ):

errors seen in SHOW SLAVE STATUS output during couple of retries are as follows:

// error 1
Seconds_Behind_Master: NULL
Last_SQL_Errno: 1062
Last_SQL_Error: Could not execute Write_rows event on


// error 2
Seconds_Behind_Master: NULL
Last_SQL_Errno: 1032
Last_SQL_Error: Could not execute Delete_rows event on

MySQL Version Details:

mysql  Ver 14.14 Distrib 5.7.22-22, for debian-linux-gnu (x86_64) using  7.0

And, if you think my bin and relay logs at master are out of sync if the problem is due to that, what is the most easiest way to reset them at master; without stopping any apps that are reading from and writing to master. I can setup slave after that from the start without a problem. Thank you in advance!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source