mysql插入insert报错,默认utf8是mb3,主库是mb4。
-- 查看数据库字符集
SHOW CREATE DATABASE your_database_name;
-- 修改数据库字符集为 utf8mb4
ALTER DATABASE your_database_name CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
-- 查看表字符集
SHOW CREATE TABLE your_table_name;
-- 修改表字符集为 utf8mb4
ALTER TABLE your_table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- 查看列字符集
SHOW FULL COLUMNS FROM your_table_name;
-- 修改列字符集为 utf8mb4
ALTER TABLE your_table_name MODIFY diagndesc VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
经过修改还是不行。最后发现odbc 8.0 才支持,原文地址:https://bugs.mysql.com/bug.php?id=99732
mysql server 5.6.50 with english and thai characters serving windows client running excel through odbc and power query. excel 365 with 64bit odbc 8.0.23 (dev) works ok excel 2010 sp1 32bit (standard client) with odbc 8.0.23 32bit does not setting utf8 in odbc charset returns question marks instead of thai characters utf8mb4 returns gibberish thai
,我得是5.33
-- ALTER DATABASE rm CHARACTER SET = utf8 COLLATE = utf8mb4_unicode_ci;
ALTER TABLE lis_app CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE lis_app MODIFY diagndesc VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- Driver={MySQL ODBC 8.0 Unicode Driver}
安装8.0 odbc
成功解决。

浙公网安备 33010602011771号