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

 


posted @ 2015-07-24 07:39  星月缘  阅读(703)  评论(0编辑  收藏  举报