1 查看数据库字符集参数信息
mysql> show variables like 'character%'; +--------------------------+----------------------------+ | Variable_name | Value | +--------------------------+----------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | utf8 | | character_set_system | utf8 | | character_sets_dir | /opt/mysql/share/charsets/ | +--------------------------+----------------------------+
注:字符集为utf-8
2 创建默认数据库
mysql> create database clas; Query OK, 1 row affected (0.03 sec)
mysql> show create database clas; +----------+---------------------------------------------------------------+ | Database | Create Database | +----------+---------------------------------------------------------------+ | clas | CREATE DATABASE `clas` /*!40100 DEFAULT CHARACTER SET utf8 */ | +----------+---------------------------------------------------------------+ 1 row in set (0.00 sec)
mysql>
注:默认数据库不指定字符集的情况下,默认与character_set_server保持一致。 |