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