- 查询服务器字符集
root@127.0.0.1 : testdb【10:47:21】116 SQL->show variables like 'character_set_server';
+----------------------+---------+
| Variable_name | Value |
+----------------------+---------+
| character_set_server | utf8mb4 |
+----------------------+---------+
- 查询服务器字符集校对规则
#校对规则命名约定:
# _ci【大小写不敏感】,
#_cs【大小写敏感】,
#_bin【二元,即比较是基于字符编码的值而与languange无关】
root@127.0.0.1 : testdb【10:47:23】117 SQL->show variables like 'collation_server';
+------------------+--------------------+
| Variable_name | Value |
+------------------+--------------------+
| collation_server | utf8mb4_0900_ai_ci |
+------------------+--------------------+
- 查询数据库字符集
root@127.0.0.1 : testdb【10:50:24】118 SQL->show variables like 'character_set_database';
+------------------------+---------+
| Variable_name | Value |
+------------------------+---------+
| character_set_database | utf8mb4 |
+------------------------+---------+
- 查询数据库字符集校对规则
root@127.0.0.1 : testdb【10:52:16】121 SQL->show variables like 'collation_database';
+--------------------+--------------------+
| Variable_name | Value |
+--------------------+--------------------+
| collation_database | utf8mb4_0900_ai_ci |
+--------------------+--------------------+
- 查询表的字符集及校对规则
root@127.0.0.1 : testdb【10:52:56】123 SQL->show create table t1 \G;
*************************** 1. row ***************************
Table: t1
Create Table: CREATE TABLE `t1` (
`aaa` int(11) DEFAULT NULL,
`bbb` varchar(10) DEFAULT NULL
) /*!50100 TABLESPACE `testdb_ud` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
网友评论