mysql误删用户表数据怎么找回用户

来源:互联网 发布:网站性能优化技术 编辑:程序博客网 时间:2024/06/05 04:11
1,在my.ini 文件末尾添加skip-grant-tables
2,无用户状态登录mysql客户端

3,执行命令

flush privileges;

否则报:The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement

4,添加用户命令

GRANT USAGE ON *.* TO 'root'@'localhost' IDENTIFIED BY '123456' WITH GRANT OPTION;

不要用insert,否则报:mysql ssl_cipher cannot be null

5,更新用户权限命令

update user set Host='localhost',select_priv='y',insert_priv='y',update_priv='y',Alter_priv='y',delete_priv='y',create_priv='y',drop_priv='y',reload_priv='y',shutdown_priv='y',Process_priv='y',file_priv='y',grant_priv='y',References_priv='y',index_priv='y',create_user_priv='y',show_db_priv='y',super_priv='y',create_tmp_table_priv='y',Lock_tables_priv='y',execute_priv='y',repl_slave_priv='y',repl_client_priv='y',create_view_priv='y',show_view_priv='y',create_routine_priv='y',alter_routine_priv='y',create_user_priv='y' where user='root';commit;