How can I reset the password for MySQL? [duplicate]

I have an old MySQL installation for which I do not have the password. How can I reset the password? My first idea was to completely remove it and reinstall with a new password.

I am using Windows Vista.


Solution 1:

Using Windows 7, here's what I had to do:

  1. Uninstsall MySQL using the uninstaller.
  2. Delete C:\Program Files\MySQL
  3. Delete C:\Program Files (x86)\MySQL
  4. Delete C:\ProgramData\MySQL
  5. Delete from any Users' AppData folders. Example: C:\Users\rdoverby\AppData\Roaming\MySQL
  6. Reinstall MySQL

Solution 2:

lg's answer is correct. One additional hint:

You can reset the root PW without reinstalling MySQL. See the documentation:

B.5.4.1. How to Reset the Root Password

Solution 3:

Uninstall MySql server from control panel and then delete the "data" directory. Usually the "data" directory is at the same level of "bin" directory (\Program Files\Mysql\Mysql Server 5.x\data). The user and root password are stored in the mysql database (data\mysql).

Solution 4:

I too was having the same issue. I uninstalled MySQL, removed the folder (C:\mysql in my case). Open Windows Explorer and goto Tools. Select the "View" tab and under "Hidden files and Folders" choose "Show hidden files and folders".

Now navigate to C:\Documents and Settings\All Users\Application Data. There should be a MySQL folder in there. Delete it and reinstall. Worked fine for me after that.

Solution 5:

to re install mysql (caused me alot of trouble and nothing in the postings seemed to help so i tried it hard till i got it right)

  1. stop and remove service using the mysql config wizzard OR ControlPanel/ stop MYSQL (then cmd prompt c:\sc delete mysql)
  2. Uninstall mysql using Add/remove programs
  3. Delete the 2 installations folders as below:- a. c:\Mysql data files folder b. c:\docs and settings\all users\application data\ Mysql

restart if u fill like but not mandatory

Reinstall and enjoy!!!!