這里指的中文數(shù)據(jù)是用中文命名數(shù)據(jù)表名和字段名嗎,我建議你不要這么做,使用拼音或首字母的方式來命名,數(shù)據(jù)表后邊寫好注釋是最好的選擇。
麗水網(wǎng)站建設(shè)公司成都創(chuàng)新互聯(lián)公司,麗水網(wǎng)站設(shè)計制作,有大型網(wǎng)站制作公司豐富經(jīng)驗。已為麗水近1000家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\外貿(mào)營銷網(wǎng)站建設(shè)要多少錢,請找那個售后服務(wù)好的麗水做網(wǎng)站的公司定做!
使用中文命名數(shù)據(jù)表名和字段,實際使用中頻繁會頻繁切換輸入法來查詢,會很繁瑣,其次,中文在編輯器和頁面中存在編碼的問題,會導(dǎo)致程序報錯,再一個,別人拿到你的程序文件,根據(jù)數(shù)表名可以直接猜到你的數(shù)據(jù)表的用途,這也是不安全的。
有兩種方法...你試一下...不行的話加我的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.
進入在命令提示符下登錄mysql
輸入
charset
gb2312
你再嘗試使用
insert
into
插入一條記看看...
MySQL 中何存中文方法如下:
1、create table的時候加上:ENGINE=InnoDB DEFAULT CHARSET=gbk;
例如:
CREATE TABLE t_department (
sid varchar(32) NOT NULL,
pid varchar(32) NOT NULL,
thedata varchar(50) NOT NULL
ENGINE=InnoDB DEFAULT CHARSET=gbk;
2、打開MySQL目錄下的my.ini文件,把里面所有的default-character-set選項設(shè)為GBK或者GB2312,保存后重啟MySQL。
3、mysql數(shù)據(jù)庫安裝的時候。選擇語言為gbk,這樣在數(shù)據(jù)庫中才可以存放中文。