字符集导致的恢复失败

2023年 8月 15日 72.2k 0

说明:PXC是从5.7 升级到8.0.25

现象:在一个安装好的8.0.25 mysql中做恢复演练。

[root@dba-testbak ~]# cat /tmp/imp162.log
ERROR 1273 (HY000) at line 39: Unknown collation: 'utf8mb4_0900_ai_ci'
[root@dba-testbak ~]#

查看MySQL8.0.25字符集

root@dba-testbak 13:35: [(none)]> SHOW VARIABLES WHERE Variable_name LIKE 'character_set_%' OR Variable_name LIKE 'collation%';
+--------------------------+--------------------+
| Variable_name | Value |
+--------------------------+--------------------+
| character_set_client | utf8mb3 |
| character_set_connection | utf8mb3 |
| character_set_database | utf8mb4 |
| character_set_filesystem | binary |
| character_set_results | utf8mb3 |
| character_set_server | utf8mb4 |
| character_set_system | utf8mb3 |
| collation_connection | utf8_general_ci |
| collation_database | utf8mb4_0900_ai_ci |
| collation_server | utf8mb4_0900_ai_ci |
+--------------------------+--------------------+
10 rows in set (0.00 sec)

查看PXC8.0.25字符集

mysql> SHOW VARIABLES WHERE Variable_name LIKE 'character_set_%' OR Variable_name LIKE 'collation%';
+--------------------------+--------------------+
| 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 |
| collation_connection | utf8mb4_0900_ai_ci |
| collation_database | utf8mb4_0900_ai_ci |
| collation_server | utf8mb4_0900_ai_ci |
+--------------------------+--------------------+
10 rows in set (0.00 sec)

那么改字符集吧

[mysqld]
init-connect = 'set collation_connection = utf8mb4_0900_ai_ci;'

重新启动数据库,然后进行查看

创建一个普通用户看看

官方文档

https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html

翻译过来需要注意的

相关文章

Oracle如何使用授予和撤销权限的语法和示例
Awesome Project: 探索 MatrixOrigin 云原生分布式数据库
下载丨66页PDF,云和恩墨技术通讯(2024年7月刊)
社区版oceanbase安装
Oracle 导出CSV工具-sqluldr2
ETL数据集成丨快速将MySQL数据迁移至Doris数据库

发布评论