Home > Database > Mysql Tutorial > mysql-MySQL字符编码问题求解

mysql-MySQL字符编码问题求解

WBOY
Release: 2016-06-06 09:36:30
Original
964 people have browsed it

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

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template