1、建数据的编码:
+----------+----------------------------------------------------------------+
| Database | Create Database |
+----------+----------------------------------------------------------------+
| mydb3 | CREATE DATABASE `mydb3` /*!40100 DEFAULT CHARACTER SET utf8 */ |
+----------+----------------------------------------------------------------+
2、my.ini配置文件:
[mysql]
default-character-set=utf8
character-set-server=utf8
3、插入中文数据时报错,我的sql保存的也为utf-8
mysql> insert into vote(content) values('曹操');
ERROR 1366 (HY000): Incorrect string value: '\xB2\xDC\xB2\xD9' for column 'conte
nt' at row 1
求解,这是什么原因呢。 |