springdata jpa mysql5.7写入中文乱码解决
- mysql5.7默认使用latin1字符集,数据库字符集选择utf8mb4
create schema 'my_schema' default character set utf8mb4
- 连接字符串必须加上参数&characterEncoding=utf-8
- 或者修改配置文件,默认使用utf8mb4
[client]
default-character-set=utf8mb4
[mysql]
default-character-set=utf8mb4
[mysqld]
character-set-server=utf8mb4