You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MariaDB 10.11升级至11.3遇异常:变更缓冲区损坏及认证问题

MariaDB 10.11升级至11.x版本故障排查与解决方案

问题背景

在多台服务器上将MariaDB 10.11升级到11.x版本时,采用停止服务→卸载旧版本→安装11.3的流程后出现以下核心问题:

  • 新版本启动失败,报[ERROR] InnoDB: The change buffer is corrupted错误,无法执行mariadb-upgrade
  • 通过备份导入恢复数据(含系统版本表历史)后,用户无需密码即可登录(mysql.user表存在密码记录)
  • 尝试多个11.x版本均出现相同问题

当前加密配置

plugin_load_add = file_key_management
loose_file_key_management_filename = /etc/mysql/encryption/keyfile.enc
loose_file_key_management_filekey = FILE:/etc/mysql/encryption/keyfile.key
loose_file_key_management_encryption_algorithm = AES_CTR
innodb_encrypt_tables = ON
innodb_encrypt_temporary_tables = ON
innodb_encrypt_log = ON
innodb_encryption_threads = 4
innodb_encryption_rotate_key_age = 1

升级后错误日志

Mär 27 09:40:22 ln-VM mariadbd[115137]: 2024-03-27  9:40:22 0 [Note] Starting MariaDB 11.3.2-MariaDB-1:11.3.2+maria~ubu2204 source revision 068a6819eb63bcb01fdfa037c9bf3bf63c33ee42 as process 115>
Mär 27 09:40:22 ln-VM mariadbd[115137]: 2024-03-27  9:40:22 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
Mär 27 09:40:22 ln-VM mariadbd[115137]: 2024-03-27  9:40:22 0 [Note] InnoDB: Number of transaction pools: 1
Mär 27 09:40:22 ln-VM mariadbd[115137]: 2024-03-27  9:40:22 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
Mär 27 09:40:22 ln-VM mariadbd[115137]: 2024-03-27  9:40:22 0 [Note] InnoDB: Using liburing
Mär 27 09:40:22 ln-VM mariadbd[115137]: 2024-03-27  9:40:22 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
Mär 27 09:40:22 ln-VM mariadbd[115137]: 2024-03-27  9:40:22 0 [Note] InnoDB: Completed initialization of buffer pool
Mär 27 09:40:22 ln-VM mariadbd[115137]: 2024-03-27  9:40:22 0 [Note] InnoDB: File system buffers for log disabled (block size=4096 bytes)
Mär 27 09:40:22 ln-VM mariadbd[115137]: 2024-03-27  9:40:22 0 [Note] InnoDB: Resetting space id's in the doublewrite buffer
Mär 27 09:40:22 ln-VM mariadbd[115137]: 2024-03-27  9:40:22 0 [Note] InnoDB: End of log at LSN=658042216301
Mär 27 09:40:22 ln-VM mariadbd[115137]: 2024-03-27  9:40:22 0 [ERROR] InnoDB: The change buffer is corrupted
Mär 27 09:40:22 ln-VM mariadbd[115137]: 2024-03-27  9:40:22 0 [ERROR] InnoDB: Plugin initialization aborted with error Data structure corruption
Mär 27 09:40:22 ln-VM mariadbd[115137]: 2024-03-27  9:40:22 0 [Note] InnoDB: Starting shutdown...
Mär 27 09:40:22 ln-VM mariadbd[115137]: 2024-03-27  9:40:22 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
Mär 27 09:40:22 ln-VM mariadbd[115137]: 2024-03-27  9:40:22 0 [Note] Plugin 'FEEDBACK' is disabled.
Mär 27 09:40:22 ln-VM mariadbd[115137]: 2024-03-27  9:40:22 0 [Note] Plugin 'wsrep-provider' is disabled.
Mär 27 09:40:22 ln-VM mariadbd[115137]: 2024-03-27  9:40:22 0 [ERROR] Unknown/unsupported storage engine: InnoDB
Mär 27 09:40:22 ln-VM mariadbd[115137]: 2024-03-27  9:40:22 0 [ERROR] Aborting

解决方案

一、修复InnoDB Change Buffer损坏问题

  1. 临时跳过Change Buffer校验启动
    在my.cnf(或my.ini)中添加以下配置,启动数据库:

    innodb_skip_innodb_change_buffer = ON
    

    启动后执行mariadb-upgrade完成系统表升级,之后移除该配置并重启服务。

  2. 清理损坏的Change Buffer(若临时启动无效)

    • 停止MariaDB服务
    • 备份ibdata1、ib_logfile*等InnoDB系统文件
    • 删除ib_logfile0和ib_logfile1
    • 添加innodb_force_recovery=3到配置文件,启动数据库
    • 导出所有数据库数据:mysqldump --all-databases --routines --triggers > full_backup.sql
    • 停止服务,移除innodb_force_recovery配置,删除原数据目录下的所有文件(保留配置文件)
    • 重新初始化数据库:mariadb-install-db --user=mysql --datadir=/var/lib/mysql
    • 启动服务,导入备份数据:mysql < full_backup.sql
    • 执行mariadb-upgrade完成升级

二、修复无需密码登录问题

  1. 检查用户认证插件
    登录数据库后执行:

    SELECT user, host, plugin FROM mysql.user;
    

    若用户的plugin字段为mysql_native_password之外的类型(如unix_socket),会导致无需密码登录,执行以下命令修改:

    ALTER USER 'your_user'@'%' IDENTIFIED WITH mysql_native_password BY 'your_password';
    FLUSH PRIVILEGES;
    
  2. 重置用户密码(若上述方法无效)

    • 停止MariaDB服务,添加skip-grant-tables到配置文件,启动服务
    • 登录数据库:mysql
    • 执行:
      UPDATE mysql.user SET authentication_string=PASSWORD('new_password') WHERE user='your_user' AND host='%';
      FLUSH PRIVILEGES;
      
    • 停止服务,移除skip-grant-tables配置,重启服务

内容的提问来源于stack exchange,提问作者Lucas

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.26 22:09:59