ALTER DATABASE db_name DEFAULT CHARACTER SET character_name [COLLATE …];數據庫
ALTER TABLE tbl_name CONVERT TO CHARACTER SET character_name [COLLATE …]
如:ALTER TABLE logtest CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;編碼此處寫utf8_general_ci有時候會報錯,直接寫utf8便可spa
alter table logtest convert to character set utf8;ci
ALTER TABLE tbl_name DEFAULT CHARACTER SET character_name [COLLATE…];
如:ALTER TABLE logtest DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;it
ALTER TABLE tbl_name CHANGE c_name c_name CHARACTER SET character_name [COLLATE …];
如:ALTER TABLE logtest CHANGE title title VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci;table
SHOW CREATE DATABASE db_name;test
SHOW CREATE TABLE tbl_name;數據
SHOW FULL COLUMNS FROM tbl_name;db