window环境,mysql5.1.71
配置文件中设置了:
[mysql]
default-character-set=utf8
[mysqld]
character-set-server=utf8
而且 像类似:
character_set_database =utf8
character_set_client =utf8
等变量也设置了utf8
且:
collation_database =utf8_general_ci
collation_server=utf8_general_ci
附上一张截图:
原本存进去的是三条纪录:
中文
约束
中文
结果出来的结果:
怎么解决啊?? 这个问题折磨很长时间了!!
网络上那些回答,几乎都不行...
求大神解救!!
已解决:
由于 windows 命令提示符的编码是 gbk 的, 所以,若是你设置了 ut8编码(set names utf8),则会出现乱码或其他问题,设置为gbk即可(set names gbk)。
PHP中文网2017-04-17 15:04:01
Don’t use the Windows command line console to insert, use a client software such as the official MySQL Workbench, NaviCat for MySql (this is paid), and see more here
大家讲道理2017-04-17 15:04:01
MYSQL version above and including 5.5 should be written as: character-set-server=utf8, and for versions below 5.5: default-character-set=utf8.
迷茫2017-04-17 15:04:01
The windows client is gbk. Modify the client to character_set_client = gbk and it will not work.