Re-modify password when MySQL forgot password

Source: Internet
Author: User

Error description

1045 Access denied for user ' root ' @ ' localhost ' using password Yes

1045 Access denied for user ' root ' @ ' localhost ' using password no

Solutions

1. start-up cmd-to-net stop MySQL (disable MySQL service does not start can be omitted)

2. Locate the installation path under MySQL Server 5.1 My.ini

3. Open My.ini to find [mysqld] and add the following

This sentence: Skip_grant_tables (meaning as if the MySQL service is starting to skip permission table authentication)

4. Then start the database and change the password.

Start-up, cmd-to-net start MySQL (start MySQL service)---> mysql enter (MySQL prompt will appear if successful)

5. Enter use MySQL; (Connection rights database).

6. Change Password: Update user set Password=password ("123") where user= "root"; ( don't forget the last semicolon ).

7. Refresh permissions (required steps): flush privileges;.

8. Quit quit.

9. Remove the skip_grant_tables from the My.ini in the 3rd step (do not let him skip the authorization form when starting the MySQL service)

10. Restart MySQL, then enter, use the user name root and the new password just set 123 can log in.

CMD error occurred

When we open cmd, input net stop MySQL has a system error 5 o'clock, which is not running as an administrator while running CMD. In the program-start and search-cmd mouse right-click on a run as administrator.

If you use the cmd command frequently, you can lock it to the menu bar.

Every time you have to right-click to run as Administrator is also troublesome, set a step can be directly as administrator.

    1. In C:\Windows\System32 (the operating system is divided into 32-bit and 64-bit, depending on the individual case selection), locate Cmd.exe, and then right-click Cmd.exe

    2. Select advanced in the lower right corner and tick before "Run as Administrator"

Re-open cmd just fine.

Re-modify password when MySQL forgot password

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.