问题
I have spent many hours reading and trying dozens of variations of ways to reset the root password, but I am not getting anywhere. The most complete set of instructions I found (and tried) were the following. BTW, I am running MySQL 5.5 on Win7, 32 bit.
- I created a file, c:\mysqlinit.txt, containing the two lines: UPDATE mysql.user SET Password=PASSWORD('myroot') WHERE User='root'; flush privileges;
- Stopped the MySQL55 Service from Control Panel, Admin Tools, Services
- Opened a Command prompt window (running as the admin)
- Navigated to \Program Files\MySQL\MySQL Server 5.5\bin\
- Executed the command start mysqld --init-file=C:\mysqlinit.txt
Everything seemed to work fine (no errors). At the completion of this procedure, I thought I could log on with the root user name and the above password, but when I executed the command
mysql -u root
I received the error message,
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
I am probably doing something wrong, but can't spot it and it is driving me nuts.
回答1:
A can reset password in windows with this steps:
1) Stop running Mysql service first (Administrative tools > Services )
2) "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqld.exe" -u root --skip-grant-tables
3) uninstall mysql server
4) install mysql server and set in installation:
root current password - it's must be blank
new password - set your new passowrd
confirmation new password - set your new passowrd
also there I added new admin user konst
来源:https://stackoverflow.com/questions/23025896/resetting-mysql-root-password-not-working