我如何阻止 automysqlbackup 抛出 LOCK TABLES 错误?

我如何阻止 automysqlbackup 抛出 LOCK TABLES 错误?

如何停止 automysqlbackup 的 cron.daily 脚本(安装和配置后apt-get install automysqlbackup)引发以下错误:

 mysqldump: Got error: 1142: SELECT,LOCK TABL command denied to user 
'debian-sys-maint'@'localhost' for table 'cond_instances' when using LOCK TABLES

对我来说,这个问题是在升级到 Ubuntu 12.04 LTS 后,升级到 MySQL 5.5 之后第一次出现的。

答案1

这个错误(已在 中修复)可以通过停止 automysqlbackup 转储和数据库automysqlbackup 2.6+debian.2-1来解决。这可以通过如下编辑来完成:performance_schemainformation_schema/etc/default/automysqlbackup

向 grep step 添加一个附加管道以从 DBNAMES 列表中删除performance_schema和。information_schema

因此,在以 开始的行中DBNAMES=,并在之后| grep -v ^mysql$插入

| grep -v ^performance_schema$ | grep -v ^information_schema$

最后| tr \\\r\\\n ,\一行看起来应该是这样的

DBNAMES=`mysql --defaults-file=/etc/mysql/debian.cnf --execute="SHOW DATABASES" | awk '{print $1}' | grep -v ^Database$ | grep -v ^mysql$ | grep -v ^performance_schema$ | grep -v ^information_schema$ | tr \\\r\\\n ,\ `

感谢 Jérôme Drouet。

或者,如果您使用来自 sourceforge 的原始 automysqlbackup 包而不是 apt-package,则可以通过修改 /etc/automysqlbackup/myserver.conf 中包含 CONFIG_db_exclude 的行将 performance_schema 数据库添加到排除的数据库中:

# List of DBNAMES to EXLUCDE if DBNAMES is empty, i.e. ().
CONFIG_db_exclude=( 'information_schema' 'performance_schema' )

相关内容