Operating System: WINDOWS-XP System
Database Version: mysql 5.x
Tip: Access denied for user 'root' @ 'localhost' using password yes/no
It turned out to be good. The above error was prompted when I started the system today. It is still not possible to restart MySQL.
Note that my environment here is a WINDOWS-XP system, LINUX operating system has not been verified, the situation is not clear.
1. log on to the system as an administrator to stop the MySQL service or stop the MySQL process.
2. Start the command line window of WINDOWS (usually DOS window: Run cmd) and switch to your "MySQL \ bin" directory.
For example, I am "D: \ Program Files \ MySQL Server 5.2 \ bin", and then execute the following bold command: (pay attention to your "my. ini" location)
Microsoft Windows XP [version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C: \ Documents ents and Settings \ Administrator>
Cd D: \ Program Files \ MySQL Server 5.2 \ bin
C: \ Documents ents and Settings \ Administrator> d:
D: \ Program Files \ MySQL Server 5.2 \ bin>
Mysqld -- defaults-file = "D: \ Program Files \ MySQL Server 5.2 \ my. ini" -- console -- skip-grant-tables
100608 9:04:12 InnoDB: Started; log sequence number 0 46409
100608 9:04:12 [Note] mysqld: ready for connections.
Version: '5. 2.0-falcon-alpha-community 'socket: ''port: 3306 MySQL Community
Server (GPL)
100608 9:06:57 [Warning] Found invalid password for user: 'root @ localhost'; Ign
Oring user
As long as the above information appears, it means that MySQL is up.
3. Do not close this command line window, open a command line window again, also switch to the "MySQL \ bin" directory, and then execute the following bold command:
Microsoft Windows XP [version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C: \ Documents ents and Settings \ Administrator>
Cd D: \ Program Files \ MySQL Server 5.2 \ bin
C: \ Documents ents and Settings \ Administrator> d:
D: \ Program Files \ MySQL Server 5.2 \ bin>
Mysql-u root mysql
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 1
Server version: 5.2.0-falcon-alpha-community MySQL Community Server (GPL)
Type 'help; 'or' \ H' for help. Type '\ C' to clear the buffer.
Then, the password is reset!
Mysql>
UPDATE user SET Password = PASSWORD ('root') where USER = 'root ';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
Mysql>
Flush privileges;
Query OK, 0 rows affected (0.00 sec)
Mysql>
Quit
Bye
4. Now, you can close the first DOS window (close the service ). Open the system service control window (Control Panel-management tools-service) and start the MySQL service.
5. In the remaining Second DOS window, use the new ROOT password to connect to MySQL.
D: \ Program Files \ MySQL Server 5.2 \ bin>
Mysql-u root-p
Enter password :****
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 1
Server version: 5.2.0-falcon-alpha-community-nt MySQL Community Server (GPL)
Type 'help; 'or' \ H' for help. Type '\ C' to clear the buffer.
Mysql> quit
Bye
At this point, the system has restored the ROOT user's management permissions, which is the administrator's password. It seems that the solution is not provided during official installation, and it seems to have existed for a long time...