Error 'Cannot add or update a child row: a foreign key constraint fails (`oddsmatrixdb/#sql-5869_f1ac`, CONSTRAINT `v` FOREIGN KEY (`accountId`) REFERENCES `AccountEntity` (`id`))' on query. Default database: 'oddsmatrixdb'. Query: 'ALTER TABLE `TransactionEntity` ADD CONSTRAINT `v` FOREIGN KEY(`accountId`) REFERENCES `oddsmatrixdb`.`AccountEntity`(`id`)'现在我把主机的show master得到之后从机
slave stop
CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.00002’,MASTER_LOG_POS=896292193;发现失败
Slave_IO_State:
Master_Host: 192.168.10.14
Master_User: replication
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.00002,MASTER_LOG_POS=896292193
Read_Master_Log_Pos: 899410406
Relay_Log_File: relay.000001
Relay_Log_Pos: 98
Relay_Master_Log_File: mysql-bin.00002,MASTER_LOG_POS=896292193
Slave_IO_Running: No
Slave_SQL_Running: Yes
[16:49:22] Ovidiu Stroe 说: nope
[16:49:24] Ovidiu Stroe 说: not running
[16:49:59] Ovidiu Stroe 说: 090701 10:48:07 [Note] Slave SQL thread initialized, starting replication in log 'mysql-bin.00002,MASTER_LOG_POS=896292193' at position 899410406, relay log '/var/log/mysqld/relay.000001' position: 98
090701 10:48:07 [Note] Slave I/O thread: connected to master '[email protected]:3306', replication started in log 'mysql-bin.00002,MASTER_LOG_POS=896292193' at position 899410406
090701 10:48:07 [ERROR] Error reading packet from server: Could not find first log file name in binary log index file ( server_errno=1236)
090701 10:48:07 [ERROR] Got fatal error 1236: 'Could not find first log file name in binary log index file' from master when reading data from binary log
090701 10:48:07 [Note] Slave I/O thread exiting, read up to log 'mysql-bin.00002,MASTER_LOG_POS=896292193', position 899410406
急切 不知道如何解决
slave stop
CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.00002’,MASTER_LOG_POS=896292193;发现失败
Slave_IO_State:
Master_Host: 192.168.10.14
Master_User: replication
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.00002,MASTER_LOG_POS=896292193
Read_Master_Log_Pos: 899410406
Relay_Log_File: relay.000001
Relay_Log_Pos: 98
Relay_Master_Log_File: mysql-bin.00002,MASTER_LOG_POS=896292193
Slave_IO_Running: No
Slave_SQL_Running: Yes
[16:49:22] Ovidiu Stroe 说: nope
[16:49:24] Ovidiu Stroe 说: not running
[16:49:59] Ovidiu Stroe 说: 090701 10:48:07 [Note] Slave SQL thread initialized, starting replication in log 'mysql-bin.00002,MASTER_LOG_POS=896292193' at position 899410406, relay log '/var/log/mysqld/relay.000001' position: 98
090701 10:48:07 [Note] Slave I/O thread: connected to master '[email protected]:3306', replication started in log 'mysql-bin.00002,MASTER_LOG_POS=896292193' at position 899410406
090701 10:48:07 [ERROR] Error reading packet from server: Could not find first log file name in binary log index file ( server_errno=1236)
090701 10:48:07 [ERROR] Got fatal error 1236: 'Could not find first log file name in binary log index file' from master when reading data from binary log
090701 10:48:07 [Note] Slave I/O thread exiting, read up to log 'mysql-bin.00002,MASTER_LOG_POS=896292193', position 899410406
急切 不知道如何解决
解决方案 »
- LIKE 执行一次100多秒,求强人帮助
- mysql->一个数据库里有两个表结构一样的表,我想复制一个表的内容到另一个表里,但是如果更新第一个表再复制的话第二个表不会更新这是为什么呢
- 求帮助,遇难题如下,mysql查询问题,表名Year_AvgNum,求从1970年开始到2010年,每10年求一次平均值
- 不知道在mysql存储过程如何取num的第1位 是否有 left(num ,1)
- 求一条SQL语句,更改两个表中的同一字段。两个表用相同ID关联的
- [急]在导入decimal时为什么会是负数(-8446744056209541515)
- 已经郁闷了一天了,请各位高人帮我看看!
- postgresql数据库 怎么写sql语句得到数据表中字段名称??
- mysql查询一个月所有员工 全部任务中每类任务 完成几次
- 能否提供MYSQL的JAR文件!!!!
- 关于MYSQL5.1安装问题
- 求一SQL语句
提示解决思路:
/var/log/mysql
下面 mysqlbinlog .... /grep '# at'>ss.txt
之后vi看到附近的 MASTER_LOG_POS (不能选择最新的) 而要选择之后的
如果最新的意义不是太大 ,数据好多丢失。
数据复制环境下 的 建立新表 或者外键 非常容易导致不可思议的错误 。
CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.00002’,MASTER_LOG_POS=896292193;
你的做法是重新指定一个log文件让从机去读,又不改log index,当然不行。“之后vi看到附近的 MASTER_LOG_POS (不能选择最新的) 而要选择之后的 ”,这个方法感觉本质和上面无异,也是重新找一个新位置开始复制,应该一样会出外键的问题呀。
感谢关注这个难题。
我初步想法是 停从机, 之后快速分别在主从机上 分别建立 pk fk
之后再启动从机,这样保证同步(否则还是会出现那个错误)。