数据库创建与参数字符集关系

论坛 期权论坛 脚本     
已经匿名di用户   2022-5-29 19:27   2491   0

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保持一致。

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:81
帖子:4969
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP