日期:2014-05-16  浏览次数:20744 次

mysql主从服务器同步出现如下错误,急,在线等高分100
mysql> show slave status\G
*************************** 1. row ***************************
  Slave_IO_State: Waiting for master to send event
  Master_Host: 122.224.95.144
  Master_User: slaver
  Master_Port: 3306
  Connect_Retry: 60
  Master_Log_File: mysql-bin.000048
  Read_Master_Log_Pos: 137205272
  Relay_Log_File: localhost-relay-bin.000052
  Relay_Log_Pos: 944094
  Relay_Master_Log_File: mysql-bin.000037
  Slave_IO_Running: Yes
  Slave_SQL_Running: No
  Replicate_Do_DB: human_resource
  Replicate_Ignore_DB: 
  Replicate_Do_Table: 
  Replicate_Ignore_Table: 
  Replicate_Wild_Do_Table: 
  Replicate_Wild_Ignore_Table: 
  Last_Errno: 1091
  Last_Error: Error 'Can't DROP 'user_id_2'; check that column/key exists' on query. Default database: 'human_resource'. Query: 'ALTER TABLE `company_position` DROP INDEX `user_id_2`'
  Skip_Counter: 0
  Exec_Master_Log_Pos: 943949
  Relay_Log_Space: 148482078
  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: 2003
  Last_IO_Error: error reconnecting to master 'slaver@122.224.95.144:3306' - retry-time: 60 retries: 86400
  Last_SQL_Errno: 1091
  Last_SQL_Error: Error 'Can't DROP 'user_id_2'; check that column/key exists' on query. Default database: 'human_resource'. Query: 'ALTER TABLE `company_position` DROP INDEX `user_id_2`'
1 row in set (0.00 sec)


------解决方案--------------------
您的从服务器数据和主服务器不一致,从服务器没有这个索引
'ALTER TABLE `company_position` DROP INDEX `user_id_2

主服务器上看看这个语句,删除索引可以跳过去的
SHOW BINLOG EVENTS IN 'mysql-bin.000048' FROM 137205272;

从服务器上执行,就可以跳过一个语句
SET GLOBAL sql_slave_skip_counter = 1;

参见
http://dev.mysql.com/doc/refman/5.1/en/set-global-sql-slave-skip-counter.html
------解决方案--------------------
这个位置,上面看错了

主服务器上看看这个语句,删除索引可以跳过去的
SHOW BINLOG EVENTS IN 'mysql-bin.000037' FROM 943949;

------解决方案--------------------
、?
????????????????????????
------解决方案--------------------
意思就是说你从机上没有那个INDEX,但是现在要执行,所以就报错了。
------解决方案--------------------
1. mysql> stop slave; 
2. mysql> set global sql_slave_skip_counter=1;
3. mysql> start slave;
------解决方案--------------------
http://hi.baidu.com/ytjwt/blog/item/5f355acf4dd9d635b600c893.html