Operating System: Windows 7 System database version: mysql5.1 prompt: mysqlERROR1045accessdeniedforuserroot @ localhostusingpasswordyesno no access via localhost and 127.0.0.1 no problem, this error occurs when accessing through IP address 1. The Administrator logs on to the system
Operating System: Windows 7 database version: mysql 5.1 prompt: mysql ERROR 1045 access denied for user 'root' @ 'localhost' using password yes/no access via localhost and 127.0.0.1 no problem, error 1. log on to the system as an administrator, stop MySQL service, or end MyS
Operating System: Windows 7
Database Version: mysql 5.1
Tip: mysql ERROR 1045 access denied for user 'root' @ 'localhost' using password yes/no
There is no problem accessing through localhost and 127.0.0.1. This error occurs when accessing through IP address.
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: \> cd D: \ Program Files \ MySQL Server 5.2 \ bin
C: \> 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: \> cd D: \ Program Files \ MySQL Server 5.2 \ bin
C: \> 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...