mysql5.1 forgot root password solution under windows [win7]

mysql5.1 forgot root password solution under windows [win7] The
steps are as follows:
1. Stop the mysql service (as an administrator, run under the cmd command line) net stop mysql
2. Use the mysqld –skip-grant-tables command to start mysql Database
D:\>net stop mysql MySQL service is stopping. MySQL service stopped successfully. D:\>mysqld --skip-grant-tables
3. Open a new cmd window and perform the following operations
D:\>mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.1.26-rc-community MySQL Community Server (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> update mysql. user set password=password( 'root') where user='root';
Query OK, 1 row affected (0.02 sec) Rows matched: 2 Changed: 1 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.
4. Open the task manager, stop the mysql, mysqld processes, use net start mysql to start the mysqld service, you can use the root user root password to enter the database
mysql -uroot -proot
Supplementary instructions:
1. The mysqld instructions can be viewed using the following commands :
mysqld --verbose --help > d:\mysqld_help.txt
The help of --skip-grant-tables is:
--skip-grant-tables Start without grant tables. This gives all users FULL ACCESS to all tables!
So We can use mysql -uroot to log in directly to mysql without a password, and we can modify any table.
2. If the mysql environment variable is not configured, you need to cd to the mysql bin directory to execute the above command.
3. Refer to: http://www.kuqin.com/database/20080306/4249.html, but 5.1 may not have the mysqld-nt command, in fact, mysqld is the corresponding mysqld-nt command.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326926494&siteId=291194637