MySQL root password is lost reset Error 1045 (28000)

Source: Internet
Author: User
Tags flush mysql in

The latest version of 5.5.15 MySQL installed in Windows is quite smooth (also support Xeon Cup good good), but always prompted me to root wrong, when I logged in, I was very crash,
In my reset a few times password, still invalid situation, I collapsed, ready to replace Windows system, inadvertently hit the system patch, and then uninstall reinstall, incredibly good, so far do not know is a patch problem, or reload the problem!
Caution, download and then install software to Windows when the best to update the patch package, so as to avoid such strange things

Once the command line is flashed, you can perform a MySQL encounter under bin in the installation directory: ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using password:yes) solution

Log into the Windows system as a system administrator.

2. If MySQL is started, turn it off first.

3. Open Command Window cmd.

If you did not close MySQL in the previous step, you can use net start to see if MySQL is still in the startup state. In the startup state, use the net stop MySQL instructions to stop.

4. Switch to MySQL installation path in the Bin folder, if it is a preset path, should be under the D:\MySQL\MySQL Server 5.5.15\bin.

5. Execute mysqld–skip-grant-tables, this instruction is used to start MySQL, but will skip permission check.

6. After the execution of the last instruction, the command window stopped in the running state of MySQL, can not enter the instruction, so to reopen a new CMD command window.
Also switch to MySQL installation path in the Bin folder, execute MySQL

7. In the mysql> model, the implementation

The code is as follows Copy Code
Update Mysql.user set Password=password (' 123456′) where user= ' root ';
Flush privileges;
Quit

The above steps will reset the forgotten password.

8. Back to the DOS command mode, execute mysqladmin-u root-p shutdown, enter the password just changed 123456. Turn off the current MySQL no permission mode.

9. Start MySQL again normally.

10. Re-enter Mysql-u root-p
You'll be able to type in your correct password.

Two. Unix&linux:

1. User login system with root or running mysqld;
2. Use KILL command to end the process of mysqld;
3. To start the MySQL Server with the –skip-grant-tables parameter

The code is as follows Copy Code
Shell>;mysqld_safe–skip-grant-tables & (write full path)

4. Set a new password for root@localhost

The code is as follows Copy Code
Shell>;mysqladmin-u root flush-privileges password "NewPassword" or directly into the MySQL table to modify password
Such as:
>;use MySQL
>;update User Set Password=password ("New_pass" where user= "root";
>;flush privileges;

5. Restart MySQL Server

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.