MySQL error code 1217 (ER_ROW_IS_REFERENCED): Cannot delete or update a parent row: a foreign key co

There was an error copying the development environment from the library with the following error message:
mysql> show slave status\G;
Last_Errno: 1217
Last_Error: Error ‘Cannot delete or update a parent row: a foreign key constraint fails’ on query.
# perror 1217
MySQL error code 1217 (ER_ROW_IS_REFERENCED): Cannot delete or update a parent row: a foreign key constraint fails
mysql> show variables like ‘foreign_key_checks’;
+ — — — — — — — — — — — — — — — — — — — – + — — — — — — — +
| Variable_name Value | |
+ — — — — — — — — — — — — — — — — — — — – + — — — — — — — +
| foreign_key_checks | ON |
+ — — — — — — — — — — — — — — — — — — — – + — — — — — — — +
1 row in the set (0.00) sec)

Solution:
1. First stop slave, forbid foreign key constraint detection, start slave;
stop slave; set global foreign_key_checks =off; start slave;

2. Observe the normal synchronous replication by show Slave Status \G, start the foreign key constraint detection, and restart the replication.

set global foreign_key_checks =off; stop slave; start slave;
This operation is limited to the development environment and should be used with caution in the production environment.

Read More: