2

I'm kind of stuck on what to do with this. There were several options I found between this site and the mysql site on how to resolve a forgotten root password, but I think I've now broken it.

  1. I was unable to use the line command with the created reset text file that mysql.com recommended here

  2. So I uninstalled WAMP which is what I had used to install it to begin with. That also failed because after reinstall I had a new version and I couldnt log into either of them. Apparently both versions were still there as uninstalling WAMP didnt uninstall MySQL.

  3. So I tried the make-sure-everything-is-deleted steps here and rebooted and reinstalled WAMP. No go, won't take default password.

  4. Tried to run the command line command using the newest version and got this error.

Now I can't do anything I need to get done and all other posts I find on this seem to be variants of these things I've already tried.

Community
  • 1
  • 1
red6
  • 102
  • 2
  • 11

2 Answers2

0

This time around, the newer version of mysql let me log in with no password. I was able to get it fixed from the command line and get it reset to what I wanted. Tried that multiple times before, so I cannot say I understand what changed now, but it did.

red6
  • 102
  • 2
  • 11
0

Try to reset you password as described here

  1. stop the mysql service (likely requires user to be admin/root)
  2. write ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass'; into new file and save it under C:\mysql-init.txt (for windows)
  3. Open cmd.exe (with admin privilges) and enter commands (see below)

Commands

 C:\> cd "C:\Program Files\MySQL\MySQL Server 8.0\bin"
 C:\> mysqld --init-file=C:\\mysql-init.txt

It worked for me.

surfmuggle
  • 5,527
  • 7
  • 48
  • 77
bogdenoff
  • 11
  • 1
  • 1
    Could You please consider adding some more details instead of bluntly linking to some offsite resource? – Kamiccolo Feb 26 '15 at 21:07
  • 1. Log on to your system as Administrator. 2. Stop the MySQL server if it is running. For a server that is running as a Windows service, go to the Services manager: From the Start menu, select Control Panel, then Administrative Tools, then Services. Find the MySQL service in the list and stop it. If your server is not running as a service, you may need to use the Task Manager to force it to stop. – bogdenoff Mar 10 '15 at 11:05
  • 3.Create a text file containing the following statements. Replace the password with the password that you want to use. UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root'; FLUSH PRIVILEGES; Write the UPDATE and FLUSH statements each on a single line. The UPDATE statement resets the password for all root accounts, and the FLUSH statement tells the server to reload the grant tables into memory so that it notices the password change. 4.Save the file. For this example, the file will be named C:\mysql-init.txt. – bogdenoff Mar 10 '15 at 11:08
  • 5.Open a console window to get to the command prompt: From the Start menu, select Run, then enter cmd as the command to be run. 6.Start the MySQL server with the special --init-file option (notice that the backslash in the option value is doubled): C:\> C:\mysql\bin\mysqld-nt --init-file=C:\\mysql-init.txt If you installed MySQL to a location other than C:\mysql, adjust the command accordingly. The server executes the contents of the file named by the --init-file option at startup, changing each root account password. – bogdenoff Mar 10 '15 at 11:08
  • You can also add the --console option to the command if you want server output to appear in the console window rather than in a log file. If you installed MySQL using the MySQL Installation Wizard, you may need to specify a --defaults-file option: C:\> "C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld-nt.exe" --defaults-file="C:\\Program Files\\MySQL\\MySQL Server 5.0\\my.ini" --init-file=C:\\mysql-init.txt – bogdenoff Mar 10 '15 at 11:09
  • 7.After the server has started successfully, delete C:\mysql-init.txt. You should now be able to connect to the MySQL server as root using the new password. Stop the MySQL server, then restart it in normal mode again. If you run the server as a service, start it from the Windows Services window. If you start the server manually, use whatever command you normally use. – bogdenoff Mar 10 '15 at 11:09