[Database] MAC MySQL中文乱码问题

1 确保数据库编码设置, 可修改my.cnf

mysql> show variables like '%character%';
+--------------------------+-----------------------------------------------------------+
| Variable_name | Value |
+--------------------------+-----------------------------------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
+--------------------------+-----------------------------------------------------------+

2 确保JDBC连接串带 characterEncoding=UTF-8

jdbc:mysql:///dbname?serverTimezone=UTC&characterEncoding=UTF-8&useUnicode=true&useSSL=false&allowPublicKeyRetrieval=true

3 如果用Navicat的话还得注意, Edit Connecting ==> Encoding 默认就好.

==__==   ==__==  ==__==
这里选了UTF8,结果问题问题从Spring 配置, 对象序列化, MyBatis配置,数据库配置,终端配置一直排查到这. 汗....
posted @ 2020-02-27 21:50  ABeen  阅读(150)  评论(0编辑  收藏  举报