位置: 编程技术 - 正文
推荐整理分享MySQL中主从复制重复键问题修复方法(mysql主从复制实现原理),希望有所帮助,仅作参考,欢迎阅读内容。
文章相关热门搜索词:mysql如何实现主从复制的具体流程,mysql 5.7 主从复制,mysql如何实现主从复制的具体流程,mysql主从复制主要有几种模式,mysql中主从复制会复制主库之前的数据吗,mysql中主从复制会复制主库之前的数据吗,mysql主从复制主要有几种模式,mysql主从复制原理以及架构,内容如对您有帮助,希望把文章链接给更多的朋友!
-------------------quote begin------------------------ 3. If you decide that you can skip the next statement from the master, issue the following statements: mysql> SET GLOBAL SQL_SLAVE_SKIP_COUNTER = n; mysql> START SLAVE; The value of n should be 1 if the next statement from the master does not use AUTO_INCREMENT or LAST_INSERT_ID(). Otherwise, the value should be 2. The reason for using a value of 2 for statements that use AUTO_INCREMENT or LAST_INSERT_ID() is that they take two events in the binary log of the master.
-------------------quote end------------------------
MySQL文档中的意思是当master传到slave的语句中要用到auto_increment,或者last_insert_id()时,需要skip两个event. 但实际情况并非如此
测试过程如下: ... 为master ... 为slave 同步c2cdb,初始状态ok
1. 在master上创建测试表
2, 在salve上insert 3条记录
3, 在master上insert 3条记录
4, slave 的sql thread 中止
5, skip next statemate后start slave正常
slave端errlog如下: ::[ERROR] Slave: Error 'Duplicate entry '1' for key 1' on query. Default database: 'c2cdb'. Query: 'insert into tmp_te st_(name) values('a'),('b'),('c')', Error_code:
:: [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'db_auction1-bin.' position
:: [Note] Slave SQL thread initialized, starting replication in log 'db_auction1-bin.' at position , rela y log './db_auction1_b-relay-bin.' position:
master羰binlog中相应的记录如下:
# at # :: server id 1 log_pos Intvar SET INSERT_ID=1; # at # :: server id 1 log_pos Query thread_id= exec_time=0 error_code=0 SET TIMESTAMP=; insert into tmp_test_(name) values('a'),('b'),('c');
总结:使用SET GLOBAL SQL_SLAVE_SKIP_COUNTER 命令跳过失败的SQL
MySQL密码正确却无法本地登录的解决方法 MySQLroot密码正确,却怎么也无法从本地登录MySQL,提示ERROR():Accessdeniedforuser'root'@'localhost'(usingpassword:YES)这里后来经高人指点才发现mysql库中的user
MySQL中表复制:create table like 与 create table as select CREATETABLEALIKEB此种方式在将表B复制到A时候会将表B完整的字段结构和索引复制到表A中来。CREATETABLEAASSELECTx,x,x,xxFROMBLIMIT0此种方式只会将表B的字段结构复
Mysql 的存储引擎,myisam和innodb的区别 简单的表达。MyISAM是非事务的存储引擎。innodb是支持事务的存储引擎。innodb的引擎比较适合于插入和更新操作比较多的应用而MyISAM则适合用于频繁查询
标签: mysql主从复制实现原理
本文链接地址:https://www.jiuchutong.com/biancheng/324351.html 转载请保留说明!上一篇:关于MariaDB安装问题小记(CMake Error at)(mariadb10安装)
下一篇:MySQL密码正确却无法本地登录的解决方法(mysql密码忘了怎么办?)
开始运行Cmd.exe进命令行
进入安装目录cd /Program Files/Microsoft SQL Server//Shared
输入 mofcomp "C:/Program Files/Microsoft SQL Server//Shared/sqlmgmproviderxpsp2up.mof" class="img-responsive" alt="SQL Server配置管理器无法连接到WMI提供程序(SQL server配置管理器打开TCP/IP后重启不了)">
友情链接: 武汉网站建设