为什么 MySQL 数据库副本在副本具有 bigint 密钥而主数据库具有 int 密钥时不复制?

Why MySQL database replica does not replicate when replica has bigint key and master has int key?

我尝试将主键大小或其他字段从 int 更改为 bigint。

MySQL 手册告诉我可以使用这种类型的转换(从 int 到 bigint),但我的副本出现错误:

Column 1 of table 'Items' cannot be converted from type 'int' to type 'bigint(20)'

作为例子大师table

create table Items(
 id int auto_increment,
 quantity int null
)

副本table

create table Items(
 id int auto_increment,
 quantity bigint(20) null
)

MySQL 版本 8.0.15

为什么 MySQL 在主副本上的 bigint 类型超过 int 时中断了复制?

我找到了解决方案。配置字段有问题 slave_type_conversions

默认情况下,MySQL 为空 slave_type_conversions,这意味着源表和目标表中的所有列必须属于相同类型。

我将此值更改为 ALL_LOSSY,ALL_NON_LOSSY 并且 MySQL 允许转换为 bigint