Resetting MySQL root password not working

为君一笑 提交于 2019-12-23 19:56:30

问题


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.

  1. I created a file, c:\mysqlinit.txt, containing the two lines: UPDATE mysql.user SET Password=PASSWORD('myroot') WHERE User='root'; flush privileges;
  2. Stopped the MySQL55 Service from Control Panel, Admin Tools, Services
  3. Opened a Command prompt window (running as the admin)
  4. Navigated to \Program Files\MySQL\MySQL Server 5.5\bin\
  5. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!