56,679
社区成员
发帖
与我相关
我的任务
分享
mysql> select charset(encode('il','df'));
+----------------------------+
| charset(encode('il','df')) |
+----------------------------+
| binary |
+----------------------------+
1 row in set (0.00 sec)
mysql>
mysql> create table teacher(
-> id int(5) auto_increment not null primary key,
-> name char(128) not null
-> ) DEFAULT CHARSET=utf8;
Query OK, 0 rows affected (0.09 sec)
mysql> insert into teacher values(Null,encode('il','df'));
ERROR 1366 (HY000): Incorrect string value: '\xC0"' for column 'name' at row 1
mysql> alter table teacher MODIFY `name` char(128) CHARACTER SET binary;
Query OK, 0 rows affected (0.14 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql>
mysql> insert into teacher values(Null, encode('il','df'));
Query OK, 1 row affected (0.06 sec)
mysql>