首页 > 其他分享 >you need (at least one of) the RELOAD privilege(s) for this operation

you need (at least one of) the RELOAD privilege(s) for this operation

时间:2023-03-07 11:07:06浏览次数:33  
标签:登录 RELOAD host user mysql need operation root localhost

问题:
新搭建的mysql5.6.20,默认没有密码直接输入mysql回车进行登录:
mysql
将root@'localhost'改为root@'%'
update mysql.user set host='%' where user='root' and host='localhost';
退出重新登录:
mysql -uroot -p123456
会直接报错账号密码错误,这时候直接输入mysql回车还可以登录
再执行:
select user,host from mysql.user;
直接报错:
Access denied; you need (at least one of) the RELOAD privilege(s) for this operation

解决办法:
因为root@'localhost' 改为root@'%'
可以使用mysql -uroot -p123456 -h 192.168.10.130登录
然后重新创建root@'localhost'账号
grant all on *.* to root@'localhost' identified by '123456' with grant option;
flush privileges;
这样子既可以远程登录root也可以本机直接登录

猜想:
将root@'localhost' 改为root@'%',host里面没有做业务ip和主机名之间的映射


标签:登录,RELOAD,host,user,mysql,need,operation,root,localhost
From: https://blog.51cto.com/u_15599306/6105474

相关文章