Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mysql master-slave synchronization exception

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

View master-slave status

Primary server

Mysql > show master status

+-+

| | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | |

+-+

| | mysql-bin.000467 | 509113942 | |

+-+

From the server

Mysql > show slave status\ G

* * 1. Row *

Slave_IO_State: Waiting for master to send event

Master_Host: 192.168.11.11

Master_User: repluser

Master_Port: 3306

Connect_Retry: 60

Master_Log_File: mysql-bin.000467

Read_Master_Log_Pos: 537072113

Relay_Log_File: mysql-relay-bin.001357

Relay_Log_Pos: 789610157

Relay_Master_Log_File: mysql-bin.000454

Slave_IO_Running: Yes

Slave_SQL_Running: No

Replicate_Do_DB:

Replicate_Ignore_DB: mysql,information_schema

Replicate_Do_Table:

Replicate_Ignore_Table:

Replicate_Wild_Do_Table:

Replicate_Wild_Ignore_Table:

Last_Errno: 1060

Last_Error: Error 'Duplicate column name' AES_TEL1'' on query. ....

Reason:

It is mistakenly believed that the slave database is the master database. After alter table modification of the table structure of the slave database, it is found that the slave database has done this operation on the master database. After the slave database has finished the operation, the slave database will also execute this statement. However, since the slave database has been modified, the master-slave thread fails to change the table, and you will see that the slave database status is as shown above. Solve this problem manually:

Mysql > set global sql_slave_skip_counter=1

Mysql > start slave

Tell the slave library to ignore this error and continue to perform synchronization.

Reference: https://www.cnblogs.com/cobbliu/p/4227183.html

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report