首页  >  文章  >  数据库  >  mysql-MySQL字符编码问题求解

mysql-MySQL字符编码问题求解

WBOY
WBOY原创
2016-06-06 09:36:30929浏览

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

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn