mysql-MySQL字符编码问题求解
首先表的创建语句如下:
create table teacher(id int primary key auto_increment,name varchar(40))DEFAULT CHARSET=utf8;
_MySQL中:show variables like 'char%' ;显示如下:
+--------------------------+---------------------------------------------------------------+
| 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 |
| character_sets_dir | C:\Program Files (x86)\MySQL\MySQL Server 5.0\share\charsets\ |
+--------------------------+---------------------------------------------------------------+
随便插入一个中文数据仍然出现错误,求解。
mysql> insert into teacher values(1,'周');
ERROR 1406 (22001): Data too long for column 'name' at row 1
上一篇: SQLite 数据库入门基础教程
下一篇: PHP的引用详解