After the master-slave Database Synchronization is completed for the first time, it is normal, but the database of one database is not synchronized during the working process. In another mysql (3307 ),
After the master-slave Database Synchronization is completed for the first time, it is normal, but the database of one database is not synchronized during the working process. In another mysql (3307 ),
So:
1. Create a temporary database in the master database and copy the table files to be imported.
2. Execute
Create database tmpdb;
Create table tmptable;
Cp mysql_date_file master_data_file // shell command copies the data table file to the master data_dir
Insert into master. tmptable select * from tmpdb. tmptable;
After execution, the data in the master database is imported normally.
Check the slave status again.
Show slave status;
Error found: not found tmpdb. tmptable (this indicates that the original error message is not recorded)
In a hurry, check that Master_Log_Pos in show master status is marked as $ Master_Log_Pos.
Then on slave, change master to MASTER_LOG_POS = $ Master_Log_Pos
Then let's look at the show master status and find 1162 errors.
The data on both sides cannot be synchronized.
......
Do you want to retry the master-slave database?
Mysqlbinlog I suddenly thought of it
So mysqlbinlog -- start-position = 190000000 -- stop-position = 200000000 xxx. binlog | grep tmptable
Locate the SQL statement that is incorrectly executed on slave
Mysqlbinlog -- start-position = 190000000 -- stop-position = 200000000 xxx. binlog | grep tmptable>/tmp/tmpbinlog
Vi/tmp/tmpbinlog (find tmptable)
Locate the next # at (a string of numbers) in the wrong SQL statement and mark it as $ NEXT_POS.
On slave, change master to MASTER_LOG_POS = $ NEXT_POS
Show slave status display:
Slave_IO_Running: Yes
Slave_ SQL _Running: Yes
Haha, complete synchronization.
If a 1062 error occurs, set slave-skip-errors = 1062 in the slave configuration file, and restart slave.