如何在 Debian 10 上的 MariaDB 10 中启用大型索引如何在 Debian 10 上的 MariaDB 10 中启用大型索引如何在 Debian 10 上的 MariaDB 10 中启用大型索引如何在 Debian 10 上的 MariaDB 10 中启用大型索引
  • 文章
  • 正则表达式
    • 工具
  • 登录
找到的结果: {phrase} (显示: {results_count} 共: {results_count_total})
显示: {results_count} 共: {results_count_total}

加载更多搜索结果...

搜索范围
模糊匹配
搜索标题
搜索内容
发表 admin at 2025年2月28日
类别
  • 未分类
标签

如何在 Debian 10 上的 MariaDB 10 中启用大型索引

本教程向您展示如何在 Debian 10 上的 MariaDB 10 中启用大索引。这指的是 MariaDB 和 MySQL 中存在的 innodb_large_prefix 选项。我将向您展示如何通过编辑 MariaDB 配置文件来永久启用大索引选项,还将向您展示如何使用 SQL 命令在当前数据库会话中临时启用它。 InnoDB 大前缀允许其索引键前缀最多为 3072 字节(对于 16k 页,否则更小)。

使用配置文件在 MariaDB 中启用 InnoDB 大型索引

编辑 MariaDB 服务器配置文件:

nano /etc/mysql/mariadb.conf.d/50-server

并将以下行放在 [mysqld] 行之后:

innodb-file-format=barracuda
innodb-file-per-table=ON
innodb-large-prefix=ON
innodb_default_row_format = 'DYNAMIC'

关闭编辑器。然后重新启动 MariaDB:

systemctl restart mariadb.service

使用 SQL 命令在 MariaDB 中启用大型索引

这些命令是配置编辑选项的替代方法,因此不要同时使用这两种方法。在控制台为root用户打开MariaDB数据库连接:

mysql -u root -p

然后运行以下命令:

SET GLOBAL innodb_file_format=Barracuda;
SET GLOBAL innodb_file_per_table=ON;
SET GLOBAL innodb_large_prefix=1;
Quit

然后再次登录并运行:

SET GLOBAL innodb_default_row_format=DYNAMIC;

现在您的 MariaDB 系统中启用了大索引前缀选项。

©2015-2025 艾丽卡 support@alaica.com