小白初学MySQL----MySQL不能使用中文的问题
建立一个库,再建一个表,来一个VARCHAR的数据,存放一句‘我爱你’,却只能显示‘???’。。。
解决方法如下(转自http://hi.baidu.com/delicious/item/6633605013fc53aeadc8570c):
看到字符集是lantin1时,则需设置gbk后才能显示中文(不然显示将是一串??????)
打开MySQL配置文件my.ini(我使用的是myhuge.ini,大家也根据自己的安装情况实践),随意找块空白贴上下面四行:
[client]
default-character-set = gbk
[mysqld]
character-set-server = gbk
重启mysql,进入mysql> status; //再次查看
--------------
c:/wamp/bin/mysql/mysql5.5.8/bin/mysql.exe Ver 14.14 Distrib 5.5.8, for Win32 (
x86)
Connection id: 3
Current database:
Current user:
SSL: Not in use
Using delimiter: ;
Server version: 5.5.8-log MySQL Community Server (GPL)
Protocol version: 10
Connection: localhost via TCP/IP
Server characterset: gbk
Db characterset: gbk
Client characterset: gbk
Conn. characterset: gbk
TCP port: 3306
Uptime: 6 min 10 sec
Threads: 1 Questions: 19 Slow queries: 0 Opens: 35 Flush tables: 1 Open tab
les: 28 Queries per second avg: 0.51
--------------
OK,此时,已可以向数据库输入中文!