1062和1063错误可以跳过 开发在从库上添加索引导致不同步。 报错如下 Last_Errno: 1061 error 'Duplicate key name 'wolf_cert_no'' on query. Default database: 'wolf'. Query: 'ALTER TABLE cpn_wolf ADD INDEX wolf_cert_no (cert_no)' 库 wolf 表 cpn_wolf 索引 wolf_cert_no (cert_no) mysql> show index from cpn_wolf; +------------+------------+--------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment | +------------+------------+--------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ | cpn_wolf | 0 | PRIMARY | 1 | id | A | 1432485 | NULL | NULL | | BTREE | | | | cpn_wolf | 1 | wolf_cert_no | 1 | cert_no | A | 1432485 | NULL | NULL | YES | BTREE | | | +------------+------------+--------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ 2 rows in set (0.00 sec) 从库上删除 ALTER TABLE `cpn_wolf` DROP INDEX `cert_no`; 从起从库 use mysql stop slave; start slave; mysql> show slave status\G; *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: 10.249.2.81 Master_User: wolf Master_Port: 3306 Connect_Retry: 60 Master_Log_File: 81-log-bin.000113 Read_Master_Log_Pos: 12001316 Relay_Log_File: 82-relay-log.000202 Relay_Log_Pos: 6159429 Relay_Master_Log_File: 81-log-bin.000103 Slave_IO_Running: Yes Slave_SQL_Running: No Replicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 1061 Last_Error: Error 'Duplicate key name 'wolf_cert_no'' on query. Default database: 'wolf'. Query: 'ALTER TABLE cpn_wolf ADD INDEX wolf_cert_no (cert_no)' Skip_Counter: 0 Exec_Master_Log_Pos: 6159265 Relay_Log_Space: 377880603 Until_Condition: None Until_Log_File: Until_Log_Pos: 0 Master_SSL_Allowed: No Master_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: NULL Master_SSL_Verify_Server_Cert: No Last_IO_Errno: 0 Last_IO_Error: Last_SQL_Errno: 1061 Last_SQL_Error: Error 'Duplicate key name 'wolf_cert_no'' on query. Default database: 'wolf'. Query: 'ALTER TABLE cpn_wolf ADD INDEX wolf_cert_no (cert_no)' Replicate_Ignore_Server_Ids: Master_Server_Id: 281 Master_UUID: 3a38cbd3-359c-11e5-ab1b-90e2ba7e4104 Master_Info_File: /data/mysql_3306/master.info SQL_Delay: 0 SQL_Remaining_Delay: NULL Slave_SQL_Running_State: Master_Retry_Count: 86400 Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: 160506 13:27:58 Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: Executed_Gtid_Set: Auto_Position: 0 1 row in set (0.00 sec)
mysql 1061报错_mysql主从 1061 log同步错误处理
最新推荐文章于 2021-08-14 14:09:47 发布