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.

1
  • My bad - Windows 7. MySQL is 5.6.12. Commented Jul 21, 2013 at 23:11

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

Comments

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.

6 Comments

Could You please consider adding some more details instead of bluntly linking to some offsite resource?
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.
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.
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.
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
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.