先把原先你创建的这个表删除,然后
CREATE
TABLE
IF
NOT
EXISTS tdb_goods(
goods_id
SMALLINT
UNSIGNED
PRIMARY
KEY
AUTO_INCREMENT,
goods_name
VARCHAR
(150)
NOT
NULL
,
goods_cate
VARCHAR
(40)
NOT
NULL
,
brand_name
VARCHAR
(40)
NOT
NULL
,
goods_price
DECIMAL
(15,3) UNSIGNED
NOT
NULL
DEFAULT
0,
is_show BOOLEAN
NOT
NULL
DEFAULT
1,
is_saleoff BOOLEAN
NOT
NULL
DEFAULT
0
)ENGINE=InnoDB
DEFAULT
CHARSET=latin1;
|
最后加上了一句,里面的InnoDB 、 latin1 改成你自己的
方法2:
一些关于查看和修改字符集的MySQL知识:
查看mysql的字符集:show variables where Variable_name like '%char%';
查看某一个数据库字符集:show create database enterprises;(注:enterprises为数据库)
查看某一个数据表字符集:show create table employees;(注:employees为数据表)
修改mysql的字符集:
mysql> set character_set_client=utf8;
mysql> set character_set_connection=utf8;
mysql> set character_set_database=utf8;
mysql> set character_set_results=utf8;
mysql> set character_set_server=utf8;
mysql> set character_set_system=utf8;
mysql> set collation_connection=utf8;
mysql> set collation_database=utf8;
mysql> set collation_server=utf8;
修改数据库enterprises的字符集:
alter database enterprises character set utf8
修改数据表employees的字符集:
alter table employees character set utf8
修改字段的字符集
alter table employees change name name char(10) character set utf-8;