MYSQL 8和5主从不一致问题

在配置mysql主从服务器时,我在windows环境下使用mysql5版本作为master,linux环境下mysql8作为slave。

主从建立后,新建数据库和表单都没有报错,但是在master导入数据后slave报错,主从不一致,无法跟随更新。

主要的错误是一个类型转换错误

Column 0 of table 'mysql.user' cannot be converted from type 'char(180(bytes))' to type 'char(255(bytes) ascii) 

查询表字段设计,发现 bigint,int类型的数据在5里面有长度显示

而8.0以上版本没有 

查了查 

官网相关资料:

MySQL Server 8.0.17 deprecated the display width for the TINYINT, SMALLINT, MEDIUMINT, INT, and BIGINT data types when the ZEROFILL modifier is not used, and MySQL Server 8.0.19 has removed the display width for those data types from results of SHOW CREATE TABLE, SHOW CREATE FUNCTION, and queries on INFORMATION_SCHEMA.COLUMNS, INFORMATION_SCHEMA.ROUTINES, and INFORMATION_SCHEMA.PARAMETERS (except for the display width for signed TINYINT(1)). This patch adjusts Connector/J to those recent changes of MySQL Server and, as a result, DatabaseMetaData, ParameterMetaData, and ResultSetMetaData now report identical results for all the above-mentioned integer types and also for the FLOAT and DOUBLE data types. (Bug #30477722)
 

也就是说8.0.17以后的版本int相关的类型都不再能查询长度,属于版本不兼容问题,主从的两个服务器版本还是要用一样的避免兼容性问题

猜你喜欢

转载自blog.csdn.net/NerfmePlz/article/details/127709455