Go to: Solution for error 1045 access denied during MySQL installation in Windows XP

Source: Internet
Author: User

I have encountered this problem and I have been looking for a long time to solve it. I want to help you!

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 \ 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 \ MySQL Server 5.2 \ bin

C: \ Documents ents 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 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 \ MySQL Server 5.2 \ bin

C: \ Documents ents 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. 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 \ 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...

 

 

It's really hard to finally get MySQL started in windows. There are a lot of problems with windows in the next step in Linux.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.