先把原先你建立的這個表刪除,然後
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;