Cause: java.sql.SQLException: Incorrect string value: ‘\xF0\x9F\x98\x80--...‘ for column ‘html_b

 <property name="connectionInitSqls" value="set names utf8mb4;" />
useUnicode=true&amp&allowMultiQueries=true&autoReconnect=true&charset=utf8mb4

my.ini

[client]
default-character-set = utf8mb4  
 
[mysql]
default-character-set = utf8mb4  
 
[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
init_connect='SET NAMES utf8mb4'  
ALTER DATABASE 数据库名 CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

alter table 表名 convert to character set utf8mb4 collate utf8mb4_bin; 
上一篇:utf8改成utf8mb4实战教程


下一篇:KKB:mysql数据库表引擎与字符集utf8mb4