https://cloud.tencent.com/developer/article/1984765?areaSource=&traceId=
我们生产环境的建表语句,之前一直要求研发提交时候不要带上字符集和排序集,这样就可以follow数据库默认的配置。但是最近发现掉坑里了。
至于是什么坑,为什么掉坑。可以看下面的例子
环境:
CentOS7
GreatSQL8.0.25,可以理解为Percona的加强版,增加了一些挺不错的feature,例如并行查询之类特性。
这个案例只要是MySQL8的任一版本就可以。
[test]> \s
--------------
/usr/local/mysql/bin/mysql Ver 8.0.25-15 for Linux on x86_64 (GreatSQL, Release 15, Revision c7feae175e0)
Connection id: 27
Current database: test
Current user: root@localhost
SSL: Not in use
Current pager: less
Using outfile: ''
Using delimiter: ;
Server version: 8.0.25-15 GreatSQL, Release 15, Revision c7feae175e0
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: utf8mb4
Db characterset: utf8mb4
Client characterset: utf8mb4
Conn. characterset: utf8mb4
UNIX socket: /data/GreatSQL/mysql.sock
Binary data as: Hexadecimal
Uptime: 15 hours 44 min 8 sec
Threads: 4 Questions: 272 Slow queries: 25 Opens: 431 Flush tables: 3 Open tables: 347 Queries per second avg: 0.004
--------------
-- 字符集和字符排序集
[test]> show global variables like '%charac%';
+--------------------------+--------------------------------------------+
| Variable_name | Value |
+--------------------------+--------------------------------------------+
| character_set_client | utf8mb4 |
| character_set_connection | utf8mb4 |
| character_set_database | utf8mb4 |
| character_set_filesystem | binary |
| character_set_results | utf8mb4 |
| character_set_server | utf8mb4 |
| character_set_system | utf8mb3 |
| character_sets_dir | /usr/local/GreatSQL-8.0.25/share/charsets/ |
+--------------------------+----------------------------