set character_set_results=gbk; 修改字符编码 推荐使用
jdbc:mysql://localhost:3306/day10?useUnicode=true&characterEncoding=utf-8
通过MySQL命令行修改:(编码可选)
mysql> set character_set_client=utf8;
mysql> set character_set_connection=utf8;
mysql> set character_set_database=utf8;
mysql> set character_set_results=utf8;
mysql> set character_set_server=utf8;
mysql> set character_set_system=utf8;
mysql> set collation_connection=utf8;
mysql> set collation_database=utf8;
mysql> set collation_server=utf8;
如果上面推荐解决不了问题,建议在上述的语句尝试一下
下面是修改数据库的编码问题
修改数据库的字符集mysql>use mydb
mysql>alter database mydb character set utf8;
创建数据库指定数据库的字符集
mysql>create database mydb character set utf8;