linux中mysql的root用户被撤销权限的恢复

无意间将mysql的root用户的insert权限给撤销了(revoke insert了),在给某个表insert into数据的时候竟然报错,如下图:linux中mysql的root用户被撤销权限的恢复
琢磨许久查看root权限,发现没有insert权限,如下图:
linux中mysql的root用户被撤销权限的恢复
尝试恢复:use mysql;然后恢复对应撤销的权限

pdate user set Select_priv ='Y' where user = 'root';

update user set Insert_priv ='Y' where user = 'root';

update user set Update_priv ='Y' where user = 'root';

update user set Delete_priv ='Y' where user = 'root';

update user set Create_priv ='Y' where user = 'root';

update user set Drop_priv ='Y' where user = 'root';

update user set Reload_priv ='Y' where user = 'root';

update user set Shutdown_priv ='Y' where user = 'root';

update user set Process_priv ='Y' where user = 'root';

update user set File_priv ='Y' where user = 'root';

update user set Grant_priv ='Y' where user = 'root';

update user set References_priv ='Y' where user = 'root';

update user set Index_priv ='Y' where user = 'root';

update user set Alter_priv ='Y' where user = 'root';

update user set Show_db_priv ='Y' where user = 'root';

update user set Super_priv ='Y' where user = 'root';

update user set Create_tmp_table_priv ='Y' where user = 'root';

update user set Lock_tables_priv ='Y' where user = 'root';

update user set Execute_priv ='Y' where user = 'root';

update user set Repl_slave_priv ='Y' where user = 'root';

update user set Repl_client_priv ='Y' where user = 'root';

update user set Create_view_priv ='Y' where user = 'root';

update user set Show_view_priv ='Y' where user = 'root';

update user set Create_routine_priv ='Y' where user = 'root';

update user set Alter_routine_priv ='Y' where user = 'root';

update user set Create_user_priv ='Y' where user = 'root';

update user set Event_priv ='Y' where user = 'root';

update user set Trigger_priv ='Y' where user = 'root';

再flush privileges;
最后退出数据库重新登录,即可恢复被撤销的权限。

###自己遇到的问题,鼓捣了一天,留作教训###

转载于:https://blog.51cto.com/6010131/2056472

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值