MySql建立指定字符集的數據庫

以建立字符集爲utf8的數據庫爲例:數據庫

CREATE DATABASE db_name DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

CREATE DATABASE 的語法:

CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name
[create_specification [, create_specification] ...]

create_specification:
[DEFAULT] CHARACTER SET charset_name
| [DEFAULT] COLLATE collation_name

 

更改數據庫的字符編碼編碼

ALTER DATABASE db_name DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci
相關文章
相關標籤/搜索