mysql dump 1449_跨版本mysqldump恢复报错Errno1449

已经有一套主从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.

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/397751.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

修复 Xcode 错误 “The identity used to sign the executable is no longer valid”

如图: 解决方法来自:http://stackoverflow.com/questions/7088441/the-identity-used-to-sign-the-executable-is-no-longer-valid/14275197 Restarting Xcode didnt work for me. What fixed it for me was going to Accounts in Xcode (in preferences…

centos设置ip

这里是centos7.vmware安装centos后需要设置ip 1.首先查看虚拟机的网络适配器信息 2.根据信息修改配置文件 vi /etc/sysconfig/network-scripts/ifcfg-ens33 图为修改后的,最初的配置为 BOOTPROTOdhcp ONBOOTno IPADDR,GATEWAY,NETMASK没有进行配置需要根据网络适配器配置手动维…

微信支付+服务器+php代码,php 微信支付企业付款(示例代码)

/*** 格式化参数格式化成url参数*/public function ToUrl($arr){$buff "";foreach ($arr as $k > $v){if($k ! "sign" && $v ! "" && !is_array($v)){$buff . $k . "" . $v . "&";}}$buff trim($b…

Spark踩坑记——数据库(Hbase+Mysql)转

转自:http://www.cnblogs.com/xlturing/p/spark.html 前言 在使用Spark Streaming的过程中对于计算产生结果的进行持久化时,我们往往需要操作数据库,去统计或者改变一些值。最近一个实时消费者处理任务,在使用spark streaming进行…

解决Failed to connect session for conifg 故障

服务器升级openssh之后jenkins构建报错了,报错信息如下: Failed to connet or change directory jenkins.plugins.publish_over.BapPublisherException:Failed to connect session for config.....Message [Algorithm negotiation fail] 升级前ssh版本&a…

78oa mysql_78oa系统版本升级方法

可升级版本预览升级方法:1、备份数据库、附件目录、二次开发程序打开开始菜单——控制面板——管理工具——服务,右键点击停止 78oa mysql service 服务,完整复制【D:\78OA\server\modules\storage\data\78oa】(数据库)文件夹至备份区域。完整…

Excel导出显示服务器意外,C# 调用Excel 出现服务器出现意外状况. (异常来自 HRESULT:0x80010105 (RPC_E_SERVERFAULT)...

C# 调用Excel 出现服务器出现意外状况. (异常来自 HRESULT:0x80010105 (RPC_E_SERVERFAULT)htmlprivate Microsoft.Office.Interop.Excel.Application xApp;private Microsoft.Office.Interop.Excel.Workbook xBook;服务器//变量xApp new Microsoft.Office.Interop.Excel.Appl…

列表、元组、字典、集合的定义、操作与综合练习

l[A,B,C] t{A,B,C}l.append(B)print(l)scores[66,77,88]d{A:66,B:77,C:88} d[B]99 d[D]111 d.pop(C) print(d)s1{A,B,C} s2{A,C,D} print(s1&s2) print(s1|s2) 转载于:https://www.cnblogs.com/chenjunyu666/p/9147417.html

xargs

find /tmp/ -name "*.log" -mtime 4 | xargs -i -t mv {} /home/ find /tmp/ -name "*.log" -mtime 4 -print0 | xargs -0 rm -f xargs(1) xargs是给命令传递参数的一个过滤器,也是组合多个命令的一个工具。它把一个数据流分割为一些足够小的块…

export mysql home_mysql的Linux下安装笔记

注:在5.7之后MySQL不在生成my-default.cnf配置。tar -xzvf mysql-5.7.28-linux-glibc2.12-x86_64.tar.gzmv mysql-5.7.28-linux-glibc2.12-x86_64.tar.gz/ /usr/local/mysql新建 useradd mysql新建文件夹mkdir /usr/local/mysql/data生成配置:./mysqld -…

[转]DevExpress GridControl 关于使用CardView的一点小结

最近项目里需要显示商品的一系列图片,打算用CardView来显示,由于第一次使用,遇到许多问题,发现网上这方面的资源很少,所以把自己的一点点实际经验小结一下,供自己和大家以后参考。 1、选择CardView&#xf…

thinkphp5 ajax搜索+分页

<center> <table > <tr> 水果名称<input type"text" name"f_name" class"f_name"> 水果分类 &…

EventBus学习

EventBus是android 下高效的发布/订阅事件总线机制&#xff0c;可以代替传统的Intent&#xff0c;Handler&#xff0c;BroadCast 或者Fragment&#xff0c;Activity&#xff0c;Service&#xff0c;线程之间传递数据&#xff0c;是一种发布订阅设计模式&#xff08;观察者模式&…

Uediter的引用和取值

页面应用Uediter控件&#xff0c;代码如下&#xff1a; <tr><td align"center" class"xwnr_j"><asp: TextBox ID "txtContent" TextMode "MultiLine" Height "274px" Width "95%" runat"serv…

java程序 构建mycircle类_Java语言程序设计(十九)对象和类的应用实例

1.我们定义一个Circle类并使用该类创建对象&#xff0c;我们创建三个圆对象&#xff0c;1.0&#xff0c;25和125&#xff0c;然后显示这三个圆的半径和面积&#xff0c;将第二个对象的半径改为100&#xff0c;然后显示它的新半径和面积。程序清单如下&#xff1a;package testc…

Django抛错不存在(DoesNotExist)

from django.core.exceptions import ObjectDoesNotExist try:disabledusers.objects.get(sAMAccountNameliu) except ObjectDoesNotExist:print a except modelname.DoesNotExist:转载于:https://www.cnblogs.com/dreamer-fish/p/5835465.html

mysql ddl dql_mysql DDL、DML、DCL、DQL区分

mysql [Structure Query Language] 的组成分4个部分&#xff1a;DDL [Data Mefinition Language] 数据定义语言DML [Data Manipulation Language]  数据操纵语言DCL [Data Control Language] 数据控制语言DQL [Data Query Language ] 数据查询语言1、…

hiho图的联通性(自留)

无向图割边割点算法 而当(u,v)为树边且low[v]>dfn[u]时&#xff0c;表示v节点只能通过该边(u,v)与u连通&#xff0c;那么(u,v)即为割边。 1 void dfs(int u) {2 //记录dfs遍历次序3 static int counter 0; 4 5 //记录节点u的子树数6 int children …

《Git权威指南》笔记2

2019独角兽企业重金招聘Python工程师标准>>> ###Git克隆 Git使用git clone命令实现版本库克隆&#xff0c;主要有如下3种用法&#xff1a; 1&#xff09;git clone <repository> <direcctory> 将repository指向的版本库创建一个克隆岛directory目录。目…

SQL数据库挂起 SQL数据库附加报错 SQL数据库824错误修复

SQL数据库挂起 SQL数据库附加报错 SQL数据库824错误修复 数据类型 MSSQL 2012数据大小 4.5 GB故障检测 附加数据库提示824错误 一般是由于断电非法关机导致页面损坏。客户要求 恢复数据库数据 ERP可直接使用。修复结果 文件传来后 检测发现页面没有及时正常关闭导致SQL认为页不…