已经有一套主从mysql,新增两个slave
主库Server version: 5.6.22-log MySQL Community Server (GPL)
旧从库Server version: 5.6.28-log MySQL Community Server (GPL)

新增SLAVE 1: Server version: 5.6.22-log MySQL Community Server (GPL)
新增SLAVE 2: Server version: 5.7.10-log MySQL Community Server (GPL)

重新初始化新的两个slave后,从就从库的mysqldump文件导入恢复,因为增加了--dump-slave参数,可以看到主库的位置。
CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.001196', MASTER_LOG_POS=71925475;

dump文件导入完成后,在新增SLAVE 1执行:
change master to master_host='192.168.72.142', master_user='repl',master_password='password',master_port=3306,MASTER_LOG_FILE='mysql-bin.001196', MASTER_LOG_POS=71925475,MASTER_CONNECT_RETRY=30;

mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Queueing master event to the relay log
Master_Host: 192.168.72.142
Master_User: repl
Master_Port: 3306
Connect_Retry: 30
Master_Log_File: mysql-bin.001201
Read_Master_Log_Pos: 821264848
Relay_Log_File: relay-bin.000002
Relay_Log_Pos: 792405
Relay_Master_Log_File: mysql-bin.001196
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: 1449
Last_Error: Error 'The user specified as a definer ('usr_pre'@'%') does not exist' on query. Default database: 'pre'. Query: 'SELECT `pre`.`_getAutoIncrement`(_utf8'taobaoSoHeader' COLLATE 'utf8_general_ci')'
Skip_Counter: 0
Exec_Master_Log_Pos: 72717597
Relay_Log_Space: 6129100284
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: 1449
Last_SQL_Error: Error 'The user specified as a definer ('usr_pre'@'%') does not exist' on query. Default database: 'pre'. Query: 'SELECT `pre`.`_getAutoIncrement`(_utf8'taobaoSoHeader' COLLATE 'utf8_general_ci')'
Replicate_Ignore_Server_Ids:
Master_Server_Id: 142
Master_UUID: 6552d58f-7323-11e5-bc52-24b6fdf64510
Master_Info_File: /mysqldata/mysql_data/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: 160217 09:44:22
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
1 row in set (0.00 sec)

用工具查看binlog日志内容,发现也出错了,网上查了一下,说是BUG
-bash-4.1$ mysqlbinlog --start-position=72717597 --stop-position=72717598 -d pre mysql-bin.001201
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 4
#160216 20:15:34 server id 142 end_log_pos 120 CRC32 0xd9c6730a Start: binlog v 4, server v 5.6.22-log created 160216 20:15:34
BINLOG '
5hLDVg+OAAAAdAAAAHgAAAAAAAQANS42LjIyLWxvZwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAAXAAEGggAAAAICAgCAAAACgoKGRkAAQpz
xtk=
'/*!*/;
ERROR: Error in Log_event::read_log_event(): 'Sanity check failed', data_len: 577005919, event_type: 111
ERROR: Could not read entry at offset 72717597: Error in log format or read error.
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;

-bash-4.1$ mysqlbinlog --start-position=72717597 --stop-position=72717598 mysql-bin.001201
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 4
#160216 20:15:34 server id 142 end_log_pos 120 CRC32 0xd9c6730a Start: binlog v 4, server v 5.6.22-log created 160216 20:15:34
BINLOG '
5hLDVg+OAAAAdAAAAHgAAAAAAAQANS42LjIyLWxvZwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAAXAAEGggAAAAICAgCAAAACgoKGRkAAQpz
xtk=
'/*!*/;
ERROR: Error in Log_event::read_log_event(): 'Sanity check failed', data_len: 577005919, event_type: 111
ERROR: Could not read entry at offset 72717597: Error in log format or read error.
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;

-bash-4.1$ mysqlbinlog --start-position=72717597 --offset=1 mysql-bin.001201
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 4
#160216 20:15:34 server id 142 end_log_pos 120 CRC32 0xd9c6730a Start: binlog v 4, server v 5.6.22-log created 160216 20:15:34
BINLOG '
5hLDVg+OAAAAdAAAAHgAAAAAAAQANS42LjIyLWxvZwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAAXAAEGggAAAAICAgCAAAACgoKGRkAAQpz
xtk=
'/*!*/;
ERROR: Error in Log_event::read_log_event(): 'Sanity check failed', data_len: 577005919, event_type: 111
ERROR: Could not read entry at offset 72717597: Error in log format or read error.
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;

怀疑权限问题
主库5.6.22上执行
mysql> show grants for 'usr_pre'@'%';
+--------------------------------------------------------------------------------------------------------+
| Grants for usr_pre@% |
+--------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'usr_pre'@'%' IDENTIFIED BY PASSWORD '*EA8D6BC15C61128B3E5AB994B3EA12A9092114C5' |
| GRANT ALL PRIVILEGES ON `pre`.* TO 'usr_pre'@'%' |
+--------------------------------------------------------------------------------------------------------+
2 rows in set (0.02 sec)

旧SLAVE 5.6.28 备份导出的从库
mysql> show grants for 'usr_pre'@'%';
+--------------------------------------------------------------------------------------------------------+
| Grants for usr_pre@% |
+--------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'usr_pre'@'%' IDENTIFIED BY PASSWORD '*EA8D6BC15C61128B3E5AB994B3EA12A9092114C5' |
| GRANT ALL PRIVILEGES ON `pre`.* TO 'usr_pre'@'%' |
+--------------------------------------------------------------------------------------------------------+
2 rows in set (0.01 sec)

新SLAVE 1是5.6.22,执行报错
mysql> show grants for 'usr_pre'@'%';
ERROR 1141 (42000): There is no such grant defined for user 'usr_pre' on host '%'

在新SLAVE 1执行
mysql> GRANT USAGE ON *.* TO 'usr_pre'@'%' IDENTIFIED BY PASSWORD '*EA8D6BC15C61128B3E5AB994B3EA12A9092114C5' ;
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON `pre`.* TO 'usr_pre'@'%';
ERROR 1133 (42000): Can't find any matching row in the user table

flush privileges;
show grants for 'usr_pre'@'%';
发现已经恢复正常

开启slave后,可以正常复制。

-----------------------
处理新增SLAVE 2:跨一个大版本,5.7.10
执行下面语句时报错:
mysql> change master to master_host='192.168.72.142', master_user='repl2',master_password='password',master_port=3306,MASTER_LOG_FILE='mysql-bin.001196', MASTER_LOG_POS=71925475,MASTER_CONNECT_RETRY=30;

ERROR 1805 (HY000): Column count of mysql.slave_master_info is wrong. Expected 25, found 23. The table is probably corrupted

处理方法:
[mysql@lt-mysql02 mysql_backup]$ mysql_upgrade -s -uroot -p
Enter password:
The --upgrade-system-tables option was used, databases won't be touched.
Checking if update is needed.
Checking server version.
Running queries to upgrade MySQL server.
The sys schema is already up to date (version 1.5.0).
Found 0 sys functions, but expected 21. Re-installing the sys schema.
Upgrading the sys schema.
Upgrade process completed successfully.
Checking if update is needed.

重复执行上面语句,恢复正常
mysql_upgrade是一个检查和升级表的命令,用于检查当前表是否和mysql server版本兼容,例如从低版本的mysqldump导入了高版本的情况。也可以用于升级系统表。
执行该命令的时候,如果该命令发现有表的兼容性有问题,那么会做表升级,
如果发现表有问题,会做表修复,如果该命令无法修复,则需要用重建的方式手工修复表或索引。
推荐每次升级后都执行mysql_upgrade

mysql_upgrade参数-s的意思是只升级系统表,不修复数据表
--upgrade-system-tables, -s
Upgrade only the system tables, do not upgrade data.

跨版本mysqldump恢复报错Errno1449的更多相关文章

  1. IE对象最后一个属性后不要加逗号,否则在IE7及以下版本中会报错

    某函数返回一个对象,如果在最后一个属性后加逗号,IE7及以下版本中会报错 正确代码: return{ top:rect.top-top, bottom:rect.bottom-top, left:re ...

  2. 解决Windows10或者其他版本Windows Update报错的问题

    最近更新系统,发现报错0x80248014,系统版本为redstone2(创意者更新). 总结发现,只要是windows各个版本自动更新报错的,如0x80开头的一系列错误,都可以通过如下步骤解决: 手 ...

  3. dotfuscator 在混淆.Net Framework 4.0以上版本的时候报错的解决方法

    dotfuscator 在混淆.Net Framework 4.0以上版本的时候报错的解决方法 在混淆的时候报错了,错误描述大致如下: Could not find a compatible vers ...

  4. 使用自编译的Emacs26.0.50build10版本,helm报错(已解决)

    使用自编译的Emacs26.0.50build10版本,helm报错(已解决) */--> code {color: #FF0000} pre.src {background-color: #0 ...

  5. 使用mysql5.7版本的mysqldump备份mysql8.0版本的数据库报错解决办法

    使用mysql5.7版本的mysqldump命令执行备份mysql8.0版本的数据库时会报错: mysqldump: Couldn't execute 'SET SQL_QUOTE_SHOW_CREA ...

  6. 一个mysqldump的报错

    1.MySQL版本 5.7.14-log 2.问题分析 mysqldump -uxxx -pxxx db_nale 一般来讲上述命令主要是用于MySQL的逻辑备份,用来备份某个数据的全部表,但是我在执 ...

  7. Gitlab 备份迁移恢复报错gtar: .: Cannot mkdir: No such file or directory

    1. 版本信息 OS: centos 6.9 Gitlab: gitlab-ce.10.7.4 gitlab-ce.10.8.0 gitlab-ce.10.8.3 gitlab-ce.10.8.4 2 ...

  8. mysqldump导出报错"mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table `file_storage` at row: 29"

    今天mysql备份的crontab自动运行的时候,出现了报警,报警内容如下 mysqldump: Error 2013: Lost connection to MySQL server during ...

  9. 替换openjdk的版本时遇到报错Transaction check error

    x想要使用jmap对jvm内存进行排查问题,但是默认安装的openjdk包中并不带有这个命令,需要新升级到新版本才有 而在安装新的版本时,遇到报错: :   file /usr/lib64/libns ...

随机推荐

  1. 洛谷1527(bzoj2738)矩阵乘法——二维树状数组+整体二分

    题目:https://www.luogu.org/problemnew/show/P1527 不难想到(?)可以用二维树状数组.但维护什么?怎么查询是难点. 因为求第k小,可以考虑记权值树状数组,把比 ...

  2. C++中const使用注意要点(二)

    当const修饰类的成员变量 1.const修饰类的非静态成员时必须在构造函数初始化列表上初始化: 在构造函数内会提示表达式必须是可修改的左值,因为在构造函数内并不是初始化,仅仅是赋值,而const类 ...

  3. Django 组件-中间件

    中间件 中间件的概念 中间件顾名思义,是介于request与response处理之间的一道处理过程,相对比较轻量级,并且在全局上改变django的输入与输出.因为改变的是全局,所以需要谨慎实用,用不好 ...

  4. Git出现提交错误--Push to origin/master was rejected(转)

    Step1:出现的问题? 在使用Git Push代码的时候,会出现Push to origin/master was rejected 的错误提示.在第一次提交到代码仓库的时候非常容易出现,因为初始化 ...

  5. 线程组ThreadGroup

      ThreadGroup线程组表示一个线程的集合.此外,线程组也可以包含其他线程组. 线程组构成一棵树,在树中,除了初始线程组外,每个线程组都有一个父线程组. 允许线程访问有关自己的线程组的信息,但 ...

  6. java.lang.ArrayIndexOutOfBoundsException异常分析及解决

    这是一个非常常见的异常,从名字上看是数组下标越界错误,解决方法就是查看为什么下标越界. 下面是一个错误示例: Exception in thread "main" java.lan ...

  7. 什么是java序列化,如何实现java序列化?

    http://veryti.com/question/539 序列化就是一种用来处理对象流的机制,所谓对象流也就是将对象的内容进行流化.可以对流化后的对象进行读写操作,也可将流化后的对象传输于网络之间 ...

  8. 检查office2016激活时间

     OFFICE 64位 和 WINDOWS 64位cscript "C:\Program Files\Microsoft Office\Office16\ospp.vbs" /ds ...

  9. python _/__/__**__区别

    "_"单下划线:"单下划线 " 开始的成员变量叫做保护变量,意思是只有类对象(即类实例)和子类对象自己能访问到这些变量,需通过类提供的接口进行访问:不能用'fr ...

  10. nginx作用

    图解nginx作用: