mysql8.0版本 the user specified as a definer ('root'@'%') does not exist问题解决

叙述(可忽略,直接看下面的解决方法)

在修改数据库数据时,遇到the user specified as a definer ('root'@'%') does not exist错误

利用网上给的方法

grant all privileges on *.* to root@"%" identified by "Passwd"

提示语法错误

原因是mysql8.0 grant授权后面不用带identified by...

重新输入

grant all privileges on *.* to 'root'@'%';

再次报错

查询资料后,发现是版本的问题,8.0.11版本之后移除了grant 语句添加用户的功能,也就是说grant...只能适用于已存在的账户,不能通过 grant... 来添加账号了。

解决方法

mysql> create user 'root'@'%' identified by '密码';
Query OK, 0 rows affected (2.35 sec)

mysql> grant all privileges on *.* to 'root'@'%';
Query OK, 0 rows affected (0.06 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.06 sec)

 

评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值