环境:Wampserver64 v3.14,里面自带了MySQL5.7
项目中执行插入语句含中文时,中文显示成问号:
重新建立数据库,确认为utf8编码,还是不行;
在MySQL数据库管理工具中,改变字符编码也不行;
最后在MySQL安装目录my.ini修改全局设置:
[mydqld]:服务端配置
[client]:客户端配置
【1】在[client]节点下添加
default-character-set=utf8
【2】在[mysqld]节点下添加
character-set-server=utf8
collation-server=utf8_general_ci
保存后重新启动MySQL服务,测试成功!