On the slave server, use the following command
Mysql> show Slave status\g;
The following conditions are displayed:
Slave_IO_Running:YesSlave_SQL_Running:No
Indicates that slave is out of sync
Workaround One (ignore the error, continue syncing):
1, first stop slave
mysql> stop Slave;
2, skip the wrong steps, the number of steps after the variable
3. Re-start slave
mysql> start slave;
4. View sync Status
Mysql> show Slave status\g;
Workaround two (re-master from, fully synchronized):
1, the Advanced Master Library to lock the table, note that the window does not close
Mysql> Flush table with read lock;
2. Backup the data
> mysqldump-uroot-p--opt-r Database >/data/bak.sql
3. Open a new window to view the main database information
Mysql> Show master status;
+------------------+----------+--------------+------------------+-------------------+| File | Position | binlog_do_db | binlog_ignore_db | Executed_gtid_set |+------------------+----------+--------------+------------------+-------------------+| mysql-bin.000005 | 1158 | | | | +------------------+----------+--------------+------------------+-------------------+
4. Stop Slave from the library
mysql> stop Slave;
5. Import the backed up data file
Mysql> Source/data/bak.sql
6. Reset Sync
mysql> Reset Slave;
7. Reset the Sync node
mysql> change MASTER tomaster_host= ' 192.168.137.233 ', master_port=3306,master_user= ' sync ', master_password= ' 123456 ', master_log_file= ' mysql-bin.000005 ', master_log_pos=1158;
Host,port,user,password Please modify the settings according to your main library, log_file and Log_pos are modified according to the master status in the main library.
8. Open Slave
mysql> start slave;
9. View slave status
Mysql> show Slave status\g;
Displaying the following information indicates normal
Slave_IO_Running:YesSlave_SQL_Running:Yes
10. Unlocking the primary database
mysql> unlock tables;
11. Add or modify data in the main library again to see if the data is synchronized from the library.
MySQL master-slave data inconsistency Slave_sql_running:no solution