mysqldump: Got error: 1142: SELECT, LOCK TABLES command denied to user 'root'@'localhost' for table 'accounts' when using LOCK TABLES

AutoMySQLBackup备份时,出现mysqldump: Got error: 1142: SELECT, LOCK TABLES command denied to user 'root'@'localhost' for table 'accounts' when using LOCK TABLES错误,具体内容如下所示

[root@DB-Server ~]# /usr/bin/automysqlbackup /etc/automysqlbackup/myserver.conf
Parsed config file "/etc/automysqlbackup/automysqlbackup.conf"
 
# Checking for permissions to write to folders:
base folder /u03 ... exists ... ok.
backup folder /u03/mysqlbackup/ ... exists ... writable? yes. Proceeding.
checking directory "/u03/mysqlbackup//daily" ... exists.
checking directory "/u03/mysqlbackup//weekly" ... exists.
checking directory "/u03/mysqlbackup//monthly" ... exists.
checking directory "/u03/mysqlbackup//latest" ... exists.
checking directory "/u03/mysqlbackup//tmp" ... exists.
checking directory "/u03/mysqlbackup//fullschema" ... exists.
checking directory "/u03/mysqlbackup//status" ... exists.
 
# Testing for installed programs
WARNING: Turning off multicore support, since pigz isn't there.
mysql ... found.
mysqldump ... found.
 
# Parsing databases ... done.
======================================================================
AutoMySQLBackup version 3.0
http://sourceforge.net/projects/automysqlbackup/
 
Backup of Database Server - localhost
Databases - mysql,performance_schema,test
Databases (monthly) - mysql,performance_schema,test
======================================================================
======================================================================
Dump full schema.
 
Rotating 4 month backups for 
 
======================================================================
 
======================================================================
Dump status.
 
Rotating 4 month backups for 
 
======================================================================
 
Backup Start Time Sat Jul 11 22:12:31 CST 2015
======================================================================
Daily Backup ...
 
Daily Backup of Database ( mysql )
Rotating 6 day backups for mysql
----------------------------------------------------------------------
Daily Backup of Database ( performance_schema )
Rotating 6 day backups for performance_schema
----------------------------------------------------------------------
Daily Backup of Database ( test )
Rotating 6 day backups for test
----------------------------------------------------------------------
 
Backup End Time Sat Jul 11 22:12:31 CST 2015
======================================================================
Total disk space used for backup storage...
Size - Location
443k /u03/mysqlbackup/
 
======================================================================
 
###### WARNING ######
Errors reported during AutoMySQLBackup execution.. Backup failed
Error log below..
Warning: Using a password on the command line interface can be insecure.
Warning: Using a password on the command line interface can be insecure.
Warning: Using a password on the command line interface can be insecure.
Warning: Using a password on the command line interface can be insecure.
Warning: Using a password on the command line interface can be insecure.
mysqldump: Got error: 1142: SELECT, LOCK TABLES command denied to user 'root'@'localhost' for table 'accounts' when using LOCK TABLES
Warning: Using a password on the command line interface can be insecure.
du: WARNING: use --si, not -H; the meaning of the -H option will soon
change to be the same as that of --dereference-args (-D)

 

 

clip_image001

 

要解决这个错误只需要修改MySQLBackup的配置文件,将参数CONFIG_mysql_dump_single_transaction设为'yes'即可解决问题。网上关于这个错误的解决方法也有设置--skip-lock-tables的。

原文地址:https://www.cnblogs.com/kerrycode/p/4639590.html