create database <数据库名>
mysql> show create database oldboy\G
*************************** 1. row ***************************
Database: oldboy
mysql> show create database oldboy\G
*************************** 1. row ***************************
Database: oldboy
Create Database: CREATE DATABASE `oldboy` /*!40100 DEFAULT CHARACTER SET utf8 */
1 row in set (0.00 sec)
建立一个名为oldboy_gbk的GBK字符集数据库
mysql> create database oldgirl CHARACTER SET gbk COLLATE gbk_chinese_ci;
Query OK, 1 row affected (0.00 sec)
mysql> show create database oldgirl\G
*************************** 1. row ***************************
Database: oldgirl
Create Database: CREATE DATABASE `oldgirl` /*!40100 DEFAULT CHARACTER SET gbk */
查看字符集和校对规则:show character set;
创建不同字符集格式的数据库命令
create database oldboy; <==默认数据库配置,相当于创建拉丁字符集数据库。
create database oldboy_gbk DEFAULT CHARACTER SET gbk COLLATE gbk_chinese_ci; #<==创建gbk字符集数据库
create database oldboy_utf8 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; <==创建utf8字符集数据库
create database oldboy; <==默认数据库配置,相当于创建拉丁字符集数据库。
create database oldboy_gbk DEFAULT CHARACTER SET gbk COLLATE gbk_chinese_ci; #<==创建gbk字符集数据库
create database oldboy_utf8 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; <==创建utf8字符集数据库