简体   繁体   English

mysqldump在perl脚本中抛出错误,但是在脚本外运行良好

[英]mysqldump throwing error in perl script , but running fine outside script

I have a script where i take backups through perl script , which is throwing error as mentioned below 我有一个脚本,我在其中通过perl脚本进行备份,这将引发错误,如下所述

mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) when trying to connect mysqldump:得到错误:1045:尝试连接时,用户'root'@'localhost'的访问被拒绝(使用密码:是)

I have the root user with with localhost mentioned as % , as per documentation all the host are allowed . 我有root用户,其中localhost提到为%,根据文档,所有主机都是允许的。

And interesting point is the mysqldump command is running fine outside script ,ie in shell prompt 有趣的一点是mysqldump命令在脚本外部运行良好,即在shell提示符下

Any ideas ???? 有任何想法吗 ????

Run this command to check if root has permissions to connect from localhost 运行此命令以检查root是否具有从localhost连接的权限

SELECT user,host 
FROM mysql.user
WHERE user = 'root'

If you do not have an entry with localhost in the host column, then root is NOT allowed to connect from localhost . 如果你没有用一个条目localhosthost列,然后root 不允许从连接localhost You should allow root to connect from locolhost by issuing a GRANT . 您应该通过发出GRANT允许rootlocolhost连接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM