重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

mysql数据表怎么添加汉字 mysql如何给表中添加数据

mysql数据表中创建中文数据

这里指的中文数据是用中文命名数据表名和字段名吗,我建议你不要这么做,使用拼音或首字母的方式来命名,数据表后边写好注释是最好的选择。

丽水网站建设公司成都创新互联公司,丽水网站设计制作,有大型网站制作公司丰富经验。已为丽水近1000家提供企业网站建设服务。企业网站搭建\外贸营销网站建设要多少钱,请找那个售后服务好的丽水做网站的公司定做!

使用中文命名数据表名和字段,实际使用中频繁会频繁切换输入法来查询,会很繁琐,其次,中文在编辑器和页面中存在编码的问题,会导致程序报错,再一个,别人拿到你的程序文件,根据数表名可以直接猜到你的数据表的用途,这也是不安全的。

怎样往MYSQL输入汉字?

有两种方法...你试一下...不行的话加我的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 中如何存中文

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选项设为GBK或者GB2312,保存后重启MySQL。

3、mysql数据库安装的时候。选择语言为gbk,这样在数据库中才可以存放中文。


网站名称:mysql数据表怎么添加汉字 mysql如何给表中添加数据
文章地址:http://cqcxhl.com/article/dojcspg.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP