mysql5.0代码行查看编码为:
+--------------------------+---------------------------------+
| Variable_name | Value |
+--------------------------+---------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
+--------------------------+---------------------------------+
my.ini文件中default-character-set=utf8
向表里插入中文数据 在Mysql视图软件里没问题
可在Mysql代码行查看是乱码(鍚嶅瓧 | 鍦板潃 | 鐖卞ソ)
而且命令行insert into ** ('中文');也不能执行
报错信息:
mysql> insert into test(name) values('多少');
ERROR 1366 (HY000): Incorrect string value: '\xB6\xE0\xC9\xD9' for column 'name' at row 1
将my.ini文件中
default-character-set=utf8
改为
default-character-set=GB2312
即可解决 注意my.ini文件中有两处 default-character-set 设置 我仅讲第一处修改 修改后命令行方式可以正常查询