MySQL错误处理--1146错误

在MySQL的主从复制过程中,出现了1146错误。提示的错误原因是:在默认的数据中找不到指定的表。
show slave status\G;现实的同步状态。
Slave_IO_Running: YES
Slave_SQL_Running: No
Last_Errno: 1146
Last_Error: Error 'Table 'coop.Coop_Data' doesn't exist' on query. Default database: 'gcore'. Query: 'update coop.Coop_Data set State='2',NameLevel='2',CheckedTime=now(),Memo='' where DAID='18601''
Skip_Counter: 0
Last_SQL_Errno: 1146
Last_SQL_Error: Error 'Table 'coop.Coop_Data' doesn't exist' on query. Default database: 'gcore'. Query: 'update coop.Coop_Data set State='2',NameLevel='2',CheckedTime=now(),Memo='' where DAID='18601''

原因是:
先使用的use db_name1,然后执行了 update db_name2.table set这种sql语句。

解决方法:
在从服务器上设置忽略该错,在my.cnf文件中添加“slave-skip-errors = 1146”,
如果少量的这种错误,直接在mysql client里面设置“set global sql_slave_skip_counter=1”;

猜你喜欢

转载自blog.51cto.com/13120271/2326345
今日推荐