方法一:在插入中文之前 先輸命令set names gbk 告訴客戶端你在這里敲的命令是GBK編碼的 客戶端會把你接下來敲的命令轉(zhuǎn)成UTF-8 你數(shù)據(jù)庫內(nèi)部的編碼還是UTF-8
從事資陽托管服務(wù)器,服務(wù)器租用,云主機(jī),網(wǎng)站空間,域名申請,CDN,網(wǎng)絡(luò)代維等服務(wù)。
方法二:修改你安裝目錄下面的my.ini這個文件 編輯這個文件 找到
[mysql]
default-character-set=utf8
把default-character-set=utf8改成default-character-set=GBK
這里的意思是告訴MySQL你在客戶端敲的命令都是GBK編碼
注:不用改[mysqld]下面的default-character-set 這里的default-character-set指的是MySQL底層存儲的字符集編碼 可以是utf8 utf8是支持各國文字的
改過后重啟服務(wù)
方法三:根據(jù)向?qū)е匦屡渲?把編碼設(shè)成gbk或gb2312 不過這把你MySQL內(nèi)部的字符集編碼都改變了 不建議
有兩種方法...你試一下...不行的話加我的QQ
76558882
1.
修改
mysql
安裝目錄下的
my.ini
修改
default-character-set=latin1
把latin1
改為
gb2312
或
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=latin1
//把
latin1
改為
gb2312或
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=latin1
//將latin1
改為
gb2312
或
gbk
2.
進(jìn)入在命令提示符下登錄mysql
輸入
charset
gb2312
你再嘗試使用
insert
into
插入一條記看看...
這種類似模擬DOS的控制臺程序包括CMD程序,都不是很好的支持中文。
凡是你看到這種程序,你就別想著怎么用中文。去下個其他工具吧