mysql - Percona 工具包对比Openark 套件。架构变更

标签 mysql amazon-rds percona

我尝试使用 pt-online-schema-change 将唯一索引添加到 RDS 数据库表的 2 列,但失败并出现以下错误:

DBD::mysql::db do failed: Access denied; you need (at least one of) the SUPER privilege(s) for this operation [for Statement "SET SQL_LOG_BIN=0"] at /usr/bin/pt-online-schema-change line 4663.

但是使用oak-online-alter-table,我的表格正在改变。该过程尚未完成,但我没有看到任何错误,输出如下:

...
-- Copying range (1230004), (1231683), progress: 24%

这些工具是否实现了不同的方法来更改表?

最佳答案

在这种情况下没有什么值得担心的。

根据MySQL Documentation on the SUPER privilege

The SUPER privilege enables an account to use CHANGE MASTER TO, KILL or mysqladmin kill to kill threads belonging to other accounts (you can always kill your own threads), PURGE BINARY LOGS, configuration changes using SET GLOBAL to modify global system variables, the mysqladmin debug command, enabling or disabling logging, performing updates even if the read_only system variable is enabled, starting and stopping replication on slave servers, specification of any account in the DEFINER attribute of stored programs and views, and enables you to connect (once) even if the connection limit controlled by the max_connections system variable is reached.

To create or alter stored functions if binary logging is enabled, you may also need the SUPER privilege, as described in Section 18.7, “Binary Logging of Stored Programs”.

禁用数据库 session 中语句的二进制日志记录需要 SUPER 权限。

事实上,根据 pt-online-schema-change 的文档

--bin-log

Allow binary logging (SET SQL_LOG_BIN=1). By default binary logging is turned off because in most cases the --tmp-table does not need to be replicated. Also, performing an online schema change in a replication environment requires careful planning else replication may be broken; see “REPLICATION”.

由此,您可以得出结论,这确实是 pt-online-schema-change 的正常行为。它尝试在默认情况下禁用其 session 中的二进制日志记录。

推荐

尝试以root@localhost 身份运行pt-online-schema-change。该用户的所有权限都应处于事件状态。

关于mysql - Percona 工具包对比Openark 套件。架构变更,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9187097/

相关文章:

mysql - Mariadb galera集群,无法添加另一个节点

c# - C# 和 Php 的 Unicode 问题

php - 尝试使用 PHP 将 MySQL 查询导出为 CSV

postgresql - rds postgres 上的 redis_fdw

java - 多用户应用程序

python - 如何使用 Python 终止休眠 MySQL 连接?

PHP测试远程MySQL服务器是否可用

php - 如何优化我的查询以免达到最大执行时间?

mysql - 如何增加 MySQL 数据库的大小?

database - 为什么 EXPLAIN 结果中的实际时间在 PostgreSQL 中的每次执行都不同?