mysql> create database sky9899;
Query OK, 1 row affected (0.00 sec)
mysql> show databases; #显示数据库
+--------------------+
| Database |
+--------------------+
| information_schema |
| db_shop |
| mysql |
| oldboy |
| oldboy_gbk |
| oldboy_utf8 |
| performance_schema |
| sky9899 |
| student |
| test |
| wordpress |
+--------------------+
11 rows in set (0.01 sec)
mysql> show create database sky9899 \G
*************************** 1. row ***************************
Database: sky9899
Create Database: CREATE DATABASE `sky9899` /*!40100 DEFAULT CHARACTER SET gbk */
1 row in set (0.00 sec)
mysql> create database sky9899_gbk CHARACTER SET gbk COLLATE gbk_chinese_ci; #创建gbk字符集数据库
Query OK, 1 row affected (0.00 sec)
mysql> show create database sky9899_gbk\G
*************************** 1. row ***************************
Database: sky9899_gbk
Create Database: CREATE DATABASE `sky9899_gbk` /*!40100 DEFAULT CHARACTER SET gbk */
1 row in set (0.00 sec)
mysql> create database sky9899_utf8 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; #创建utf8字符集数据库
Query OK, 1 row affected (0.00 sec)
mysql> show databases like 'sky9899';
+--------------------+
| Database (sky9899) |
+--------------------+
| sky9899 |
+--------------------+
1 row in set (0.00 sec)
mysql> show databases like 'sky9899%';
+---------------------+
| Database (sky9899%) |
+---------------------+
| sky9899 |
| sky9899_gbk |
| sky9899_utf8 |
+---------------------+
3 rows in set (0.01 sec)
mysql> use sky9899 #切换数据库
Database changed
mysql> select database(); #查看当前管理员所在的库名
+------------+
| database() |
+------------+
| sky9899 |
+------------+
1 row in set (0.00 sec)
标签:sky9899,Database,utf8,字符集,gbk,sec,mysql,row
From: https://blog.51cto.com/sky9896/7628656