0

I have previously used MySQL for a class about a year ago and not since. I've forgotten the password and I need to use it again. I don't need to be able to access any previous databases, so I tried stopping the service in command prompt and uninstalling then re-installing MySQL but this still resulted in me getting stuck at the "Accounts and Roles" section of the MySQL Installer where it asks for my root password.

Is there a way I can reset it or start a new root account all together? I've seen tutorials for Ubuntu but I'm not knowledgeable enough yet to translate this to windows.

0

2 Answers 2

0

It's possible re-initialize the data directory to produce an empty MySQL instance. Here is the documentation describing the process: https://dev.mysql.com/doc/refman/8.0/en/data-directory-initialization.html .

It tells the command to perform is:

bin\mysqld --initialize --console

or the following if you want to connect as root without password:

bin\mysqld --initialize-insecure --console

The data currently in the data dir would be overwritten. If there still is a chance it might be needed in future, you may find datadir param in my.cnf and backup the directory before proceeding to re-initialization.

Another possible option is to uninstall MySQL, remove or rename datadir as found in my.cnf and install again. It shouldn't ask for the old root password then.

0

https://blogs.iis.net/rickbarber/completely-uninstall-mysql-from-windows

I found this link which described precisely my situation and these steps allowed me to re-install MySQL and create a new root password

What needed to be done was to first uninstall MySQL through Add/Remove Programs in the Control Panel. When I first had this problem I assumed this would be enough to correct it, but there’s more that needs to be removed. Next you need to find the appropriate data directory which will be in a different place depending on the version of Windows you are running and if you installed MySQL with default settings or not. The link above goes into more detail about where to find this. When you find it, delete it. You should be able to reinstall MySQL at this point and it will ask for a new password and this is where you create one that is easier to remember.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.