代码层面:
jdbcUrl=jdbc:mysql://127.0.0.1:3306/dada_mgm?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull
数据库层面:
1.查看mysql字符编码
2.修改mysql配置文件
service mysql stop; sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf; #行末尾增加如下配置并保存 #character_set_server=utf8 #init_connect='SET NAMES utf8' service mysql start;