【已解决】2.0.13,mysql catalog 乱码

Viewed 35

doris 版本 2.0.13
mysql 8.0

mysql 用例
CREATE TABLE db_mom_aps_20241224.`tb_test_word` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `word_str` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_bin DEFAULT NULL COMMENT '',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin ROW_FORMAT=DYNAMIC COMMENT='';

insert into db_mom_aps_20241224.`tb_test_word` values (1,'文字1')

doris 用例
CREATE catalog  catalog_aps_back_mysql
properties (
    "type"="jdbc",
    "user"="root",
    "password"="xxxxx",
    "jdbc_url"="jdbc:mysql://:3306/db_mom_aps_20241224?useCursorFetch=true&useUnicode=true&characterEncoding=utf-8&yearIsDateType=false&tinyInt1isBit=false&rewriteBatchedStatements=true",
    "driver_url"="file:///data/soft/doris/jar/mysql-connector-java-5.1.47.jar",
    "driver_class"="com.mysql.jdbc.Driver"
);

select * from catalog_aps_back_mysql.db_mom_aps_20241224.tb_test_word

展示结果
id word_str
1 文字1

3 Answers

mysql-connector-java-5.1.47.jar
这个版本的 Driver 有 bug,换成官网推荐版本
image.png

我看已经添加了这个useUnicode=true&characterEncoding=utf-8,这是后面改的,还是新创建的时候就加了?

mysql驱动包换成 mysql-connector-j-8.3.0.jar 中文乱码问题不再出现