Operating system: WINDOWS-XP system
Database version: MySQL 5.x
Tips: Access denied for user ' root ' @ ' localhost ' using password yes/no
Originally all good, today boot up to prompt the above error, restart MySQL or not.
Note that my environment here is the WINDOWS-XP system, the LINUX system operation has not been validated, the situation is not clear.
1. Admin login system, stop MySQL service or end MySQL process.
2. Start Windows Command Line window (that is, the usual DOS window: run cmd), switch to your "mysql\bin" directory.
For example, mine is "D:\Program files\mysql\mysql Server 5.2\bin", and then execute the following bold command: (Note your "My.ini" position)
Microsoft Windows XP [version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\administrator>
CD D:\Program files\mysql\mysql Server 5.2\bin
C:\Documents and Settings\administrator>d:
D:\Program Files\mysql\mysql Server 5.2\bin>
mysqld--defaults-file= "D:\Program files\mysql\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 has been up.
3. Do not close this command line window, reopen a command line window, also cut 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 and Settings\administrator>
CD D:\Program files\mysql\mysql Server 5.2\bin
C:\Documents and Settings\administrator>d:
D:\Program Files\mysql\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. To this step, you can close the first DOS window (turn off the service). Open the System Services Control window (Control Panel-management tools-services) and start the MySQL service.
5. In the remaining Second DOS window, connect MySQL with the new ROOT password.
D:\Program Files\mysql\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 Restore ROOT User management rights complete, is the administrator password problem, strange, the official installation of the time does not give a solution, seems to have existed for a long time ...