How to solve MySQL 1045 errors

Source: Internet
Author: User

I asked Baidu for help. I checked for 1045 Errors for half a day. I checked it online and said it was a password or user permission problem. However, I have been thinking that I am using a root user. There should be no permission issues. Another post said that it was a password problem. Is it related to the password I used in the past ?? Toss, continue to toss ~~ But it cannot be passed ..... No, it's still the same as unloading and loading again. The last critical moment went wrong !!! Helpless, do not report hope to Google, a buddy said the same situation as me, "mysql5 Default Root Password is empty", so reinstall, do not set a password, skip this step and choose next> finish. Try it. If you don't enter the password, try it out ~~~ Go in. Everything works.

1045: the database cannot be connected. The user name or password is incorrect.

 

Solution: reset the root user password.

Method 1: Open "start" -- "program" -- "MySQL" -- "MySQL 5.0" -- "MySQL server instance config wizard" and click "Next" until the following dialog box appears.

Current Root Password: Enter the original password

New Root Password: Enter the new password

Confirm: Enter the new password again.

Next, you can proceed all the way... until it is successful!

1045 the essence of an error is the password issue!

Method 2:

1. log on to the system as a system administrator;

2. If the MySQL server is running, stop it.

If the server runs as a Windows Service, go to Service Manager: Start Menu-> Control Panel-> Administrative Tools-> services

If the server is not running as a service, you may need to use the task manager to force it to stop.

3. Create a text file and place the following commands in a single line:

Set password for 'root' @ 'localhost' = PASSWORD ('mynewpassword ');

Save the file with any name. In this example, the file is c: \ mysql-init.txt.

4. Enter the doscommand prompt: Start Menu-> Run-> cmd

Assume that you have installed MySQL to C: \ mysql. If you install MySql in another location, adjust the following commands.

Run the following command at the doscommand prompt:

C: \> C: \ mysql \ bin \ mysqld-NT -- init-file = C: \ mysql-init.txt

When the server is started, run the "-- init-file" option (function: Read SQL commands from the specified file at startup) to change the root user password. When the server is successfully started, delete the c: \ mysql-init.txt.

5. Stop the MySQL server and restart it in normal mode. If you run the server as a service, you should start it from the Windows service window. If the server is started manually, the command can be used as usual.

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.