加入收藏 | 设为首页 | 会员中心 | 我要投稿 平顶山站长网 (https://www.0375zz.cn/)- 分布式云、数据处理、媒体处理、图像分析、基础存储!
当前位置: 首页 > 大数据 > 正文

AutoMySQLBackup遇到的几个问题

发布时间:2022-01-14 16:36:04 所属栏目:大数据 来源:互联网
导读:使用AutoMySQLBackup时遇到错误:Error: Dependency programs are missing. Perhaps they are not in $PATH. Exiting 使用AutoMySQLBackup备份MariDB时,手工执行shell脚本中的脚本 /mysql_backup/scripts/automysqlbackup /mysql_backup/scripts/conf/myser
   使用AutoMySQLBackup时遇到错误:Error: Dependency programs are missing. Perhaps they are not in $PATH. Exiting
   使用AutoMySQLBackup备份MariDB时,手工执行shell脚本中的脚本 /mysql_backup/scripts/automysqlbackup /mysql_backup/scripts/conf/myserver.conf 没有问题。但是在作业(crontab)里面执行脚本时遇到下面错误:
 
   Note: Parsed config file /mysql_backup/scripts/conf/myserver.conf.
   Note: /etc/automysqlbackup/automysqlbackup.conf was not found - no global config file.
  Error: Dependency programs are missing. Perhaps they are not in $PATH. Exiting.
出现这个问题,一般是由于环境变量引起的。需要修改配置文件myserver.conf中的参数PATH,使用命令ps -ef | grep -i mysqld 找到mysqldump所在的路径后,配置myserver.conf的参数PATH即可解决问题。
 
案例如下所示:
 
#
# Default values are stored in the script itself. Declarations in
# /etc/automysqlbackup/automysqlbackup.conf will overwrite them. The
# declarations in here will supersede all other.
 
# Edit $PATH if mysql and mysqldump are not located in /usr/local/bin:/usr/bin:/bin:/usr/local/mysql/bin
#PATH=${PATH}:FULL_PATH_TO_YOUR_DIR_CONTAINING_MYSQL:FULL_PATH_TO_YOUR_DIR_CONTAINING_MYSQLDUMP
PATH=${PATH}:/app/mariadb/bin
2:mysqldump: Couldn't execute 'SHOW FIELDS FROM xxx': View xxxx.xxxx' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them (1356)
AutoMySQLBackup其实是封装了mysqldump的一个shell脚本,在一个案例中,具体报错如下所示:
 
Errors reported during AutoMySQLBackup execution.. Backup failed
Error log below..
mysqldump: Couldn't execute 'SHOW FIELDS FROM `xxx`': View xxxx.xxxx' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them (1356)
 
遇到这个问题,首先检查账号权限,AutoMySQLBackup使用的账号为dbbackup,具体权限如下所示,一般而言,这样的权限是没有问题的。
 
GRANT SELECT, RELOAD, LOCK TABLES, REPLICATION CLIENT, SHOW VIEW, EVENT, TRIGGER ON *.* TO 'dbbackup'@'127.0.0.1';
GRANT EXECUTE ON sys.* TO 'dbbackup'@'127.0.0.1';
FLUSH PRIVILEGES;
使用dbbackup登录MySQL,切换到对应用户数据库,执行下面命名时,还真遇到了权限问题。
 
mysql> SHOW FIELDS FROM `xxx`;
ERROR 1356 (HY000): View 'xxx.xxx' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
mysql>
然后使用root账号查看视图定义
 
mysql> show create view xxxG;
最后一一排查下来,发现是视图xxx中引用了一个Function,但是用户dbbckup没有这个函数的执行权限,所以报这个错误。授予用户下面权限后,问题解决
 
GRANT EXECUTE ON xxx.* TO 'dbbackup'@'127.0.0.1';
FLUSH PRIVILEGES;
关于这个问题,还有可能是因为视图引用了无效的表,列或函数,而不一定是视图的定义者/调用器缺乏调用它们的权限。

(编辑:平顶山站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读