×

‘Access denied; you need (at least one of) the PROCESS privilege(s) for this operation‘ when trying

hqy hqy 发表于2025-02-08 14:31:14 浏览19 评论0

抢沙发发表评论

    在备份mysql数据库时,备份脚本执行报错了:“mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces”,从该错误看是权限的问题,本以为数据库未备份成功,不过确认了下,备份的库是没有问题的。


备份脚本如下:


mysqldump -utest -p123456 student > student.sql

该脚本执行完后报错:


mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces


 原因是test用户缺少PROCESS权限,可通过以下方式解决:


1、以root用户登录msyql:msyql -uroot -p


2、将process权限赋给用户test:GRANT PROCESS ON *.* TO 'test'@'localhost';


此时又报错了:ERROR 1410 (42000): You are not allowed to create a user with GRANT


原因可能是用户与主机不一致,于是查询用户信息:


mysql> select User,Host from mysql.user;

+--------------------+-----------+

| User               | Host      |

+--------------------+-----------+

| test               | %         |

可以看到,test用户对应的host为“%”


于是,修改上面的授权语句,将localhost修改为%,即:GRANT PROCESS ON *.* TO 'test'@'%';


再次执行


GRANT PROCESS ON *.* TO 'test'@'%';

 

flush privileges;

最后再次执行备份数据库脚本,不再有报错信息。


打赏

本文链接:https://www.kinber.cn/post/4771.html 转载需授权!

分享到:


推荐本站淘宝优惠价购买喜欢的宝贝:

image.png

 您阅读本篇文章共花了: 

群贤毕至

访客