记录解决方法,方便以后查看。
有几个地方需要注意:
1.连接mysql数据库的字符串最后加上Charset=utf8;
2.mysql中character_set_XX设置都为utf8,使用show variables like '%char%'; 命令查看(mysql打开后在需要输入密码的界面直接按回车就能使用,输入密码之后回车会退出,没搞清楚什么原因。)
设置图如下
设置命令:
set character_set_database=utf8;
set character_set_server=utf8;
set character_set_client=utf8;
set character_set_connection=utf8;
set character_set_results=utf8;
(这里说一下,网上改文件的方法,改之前一定要关闭mysql服务,不然改了以后重启不了,得重新下载非常麻烦。不过据说mysql5.0以上的版本不需要修改文件,直接使用如上命令修改就行)
3.navicat 连接——编辑连接这里最好不要改,保持自动就好。(之前改成uft一直不行,改回自动就好了)