需求描述:mysql
在建立DB的时候指定字符集.sql
操做过程:数据库
1.使用create database语句建立数据库spa
mysql> create database if not exists test03 default character set = 'utf8';
Query OK, 1 row affected (0.00 sec)
备注:经过default character set = 语句来指定DB的字符集.code
2.查看建立的DB的字符集orm
mysql> select schema_name,default_character_set_name from information_schema.schemata where schema_name = 'test03'; +-------------+----------------------------+ | schema_name | default_character_set_name | +-------------+----------------------------+ | test03 | utf8 | +-------------+----------------------------+ 1 row in set (0.00 sec)
备注:经过系统表schemata查看能够知道,DB的字符集是utf8的.同时,数据库的字符集是utf8,那么在这个数据库下建立的表的字符集也都是utf8的.也就是数据库的字符集对于后续建立的表是有影响的.blog
文档建立时间:2018年6月1日14:27:07文档