码迷,mamicode.com
首页 > 数据库 > 详细

mysql添加中文,Data too long for column错误

时间:2014-12-23 15:23:33      阅读:136      评论:0      收藏:0      [点我收藏+]

标签:

最开始以为是自己字符长度问题,缩短后还是有问题。原来是因为中文编码。

解决办法:修改my.ini文件中的default_character_set=gbk;

# CLIENT SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by MySQL client applications.
# Note that only client applications shipped by MySQL are guaranteed
# to read this section. If you want your own MySQL client program to
# honor these values, you need to specify it as an option during the
# MySQL client library initialization.
#
[client]

port=3306

[mysql]

default-character-set=gbk


# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this 
# file.
#
[mysqld]

# The TCP/IP Port the MySQL Server will listen on
port=3306


#Path to installation directory. All paths are usually resolved relative to this.
basedir="C:/Program Files/MySQL/MySQL Server 5.0/"

#Path to the database root
datadir="C:/Program Files/MySQL/MySQL Server 5.0/Data/"

# The default character set that will be used when a new schema or table is
# created and no character set is defined
default-character-set=utf8

 

mysql添加中文,Data too long for column错误

标签:

原文地址:http://www.cnblogs.com/obean/p/4180082.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!