Today to learn MySQL user management, accidentally the root user in the Mysql.user table is deleted, and then can not log in MySQL, the web found the solution of Linux, I made a simple modification, changed to my Windows edition , The recovery method is as follows:
1. Turn off MySQL servicenet stop MySQL or Wamp tool off
2. Start the privilege usage mode without verifying the userSwitch to the bin directory of MySQL and execute mysqld--console--skip-grant-tables
3. Login with the root user (no password), re-authorizeGrant all privileges on * * to [e-mail protected] ' localhost ' identified by ' password ' with grant Option;flush privileges;exit Note: if Grant Authorization Error: Error 1290 (HY000): The MySQL server is running with the--skip-grant-tables option so it cannot execute this s Tatement, please perform a flush privileges first, then grant authorization.
4. Exit the privileged mode (CTRL + C)
5, normal start MySQL, you can resume use
See the Linux recovery method on the Internet1. Turn off Mysql/etc/init.d/mysql stop2, start the Privilege usage mode without verifying users/usr/local/mysql/bin/mysqld_safe--user=mysql--skip-grant-tables --skip-networking &3, use root user login (no password), re-authorize mysql-urootgrant all privileges on * * to [email protected] ' localhost ' Identified by ' Password ' with Grant Option;flush PRIVILEGES;EXIT4, restart MySQL service and resume using/etc/init.d/mysql restart
Mark, MySQL mistakenly delete root user resolution