ps -ef | grep mysqld 查看运行脚本(mysqld的配置比较特殊需要先查看记下来)
重启mysqld 或者kill掉mysqld所有进程
mysqld_safe --skip-grant-tables 跳过权限(特殊配置看第一步查看后的命令)
mysql -uroot use mysql
用户密码恢复 update user set password=password("new_pass") where user="root";
用户访问域恢复 update user set host='%' where user='root';
进入恢复权限模式 update user set Update_priv ='Y' where user = 'root'; update 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';
Mysql 恢复root授权
点赞
收藏