mysql user table root user accidentally deleted Solution

1: Stop mysql service
2: Find the my.ini mysql installation directory;
2: Locate the following fragment
[mysqld]
. 4: another line was added and stored
Skip-Grant-Tables
. 5: start mysql service
6: mysql login (username and useless password)
7: user table to find the root user added
the INSERT the INTO user (the Host, the user, password) the VALUES ( 'localhost', 'root', password ( '123456'));
. 8: root user to set permissions
update user September Host = 'localhost', SELECT_priv = 'y', insert_priv = 'y', update_priv = 'y', Alter_priv = 'y', delete_priv = 'y', create_priv = 'y', drop_priv = 'and' , 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 = 'and' super_priv = 'and' create_tmp_table_priv = 'and' Lock_tables_priv = 'and' Execute_priv = 'and' repl_slave_priv = 'and' repl_client_priv = 'and' Create_view_priv = 'and' Show_view_priv = ' and 'create_routine_priv =' y ', alter_routine_priv =' y ', create_user_priv =' and 'where user =' root ';
commit;
9:把m.

1: Stop mysql service
2: Find the my.ini mysql installation directory;
2: Locate the following fragment
[mysqld]
. 4: another line was added and stored
Skip-Grant-Tables
. 5: start mysql service
6: mysql login (username and useless password)
7: user table to find the root user added
the INSERT the INTO user (the Host, the user, password) the VALUES ( 'localhost', 'root', password ( '123456'));
. 8: root user to set permissions
update user September Host = 'localhost', SELECT_priv = 'y', insert_priv = 'y', update_priv = 'y', Alter_priv = 'y', delete_priv = 'y', create_priv = 'y', drop_priv = 'and' , 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 = 'and' super_priv = 'and' create_tmp_table_priv = 'and' Lock_tables_priv = 'and' Execute_priv = 'and' repl_slave_priv = 'and' repl_client_priv = 'and' Create_view_priv = 'and' Show_view_priv = ' and 'create_routine_priv =' y ', alter_routine_priv =' y ', create_user_priv =' and 'where user =' root ';
commit;
9:把m.

Guess you like

Origin www.cnblogs.com/wenhaoSir/p/11356113.html