转载:http://outofmemory.cn/code-snippet/2533/mysql-create-database-specify-utf-8-coding
如下脚本创建数据库yourdbname,并制定默认的字符集是utf8。
CREATE DATABASE IF NOT EXISTS yourdbname DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
如果要创建默认gbk字符集的数据库可以用下面的sql:
create database yourdb DEFAULT CHARACTER SET gbk COLLATE gbk_chinese_ci;