Tim
Tim

Reputation: 129

MySQL reinstalled, but root password still there and I forgot it

I forgot my root password in MySQL 5.1 on Windows 7 I uninstalled and deleted the MySQL directory in Program Files

Then I installed 5.5, but get error 1045, saying: Access denied for user: 'root@localhost'

I thought that uninstalling MySQL, and reinstalling would allow me to create a new root password, but apparently not. Please help!

Upvotes: 12

Views: 48431

Answers (6)

dhananjay diwale
dhananjay diwale

Reputation: 1

Uninstall the MySql than Go to C drive unhide the program data folder & delete the MySql folder which is lies inside it ..now reinstall the MySQL again

Upvotes: 0

Himanshu Aggarwal
Himanshu Aggarwal

Reputation: 1809

Actually even after uninstalling the MySQL the data still remains in the directory which is not deleted by itself. So if you want to reinstall it from scratch then follow these simple steps:

Using Windows 7/8, here's what you need to do:

  1. Uninstall 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.

And then it will hopefully work fine!

Upvotes: 11

Lmwangi
Lmwangi

Reputation: 2574

It's easy to use the init-file option to mysqld

Add either

GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'blah' WITH GRANT OPTION;

Or preferably

SET PASSWORD FOR root@localhost = PASSWORD('blah');

to a file say /reset.mysqld

Edit your /etc/my.cnf to point to this file

[mysqld]
....
init-file=/reset.mysqld
...

Restart mysqld, remove /reset.mysqld and revert your my.cnf to what it was before.

Upvotes: 5

sajdev
sajdev

Reputation: 31

  1. First uninstall MySQL Server
  2. Delete MySQL Server Application Data folder at C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.6 (Windows XP).
  3. Re-install MySQL Server via the MySQL installer.

Upvotes: 3

diyoda_
diyoda_

Reputation: 5420

The following worked for me just fine,

Now you can do this using the MYSQL installer.I downloaded the 250MB file. There you can remove all the tools (In cases they can be out dated) as well as all the MYSQL files (NOTE: These are asked to remove after uninstalling the existing tools) that causes these kind of problems. Then again you can install them using the same SQL installer.

Problem solved.

Upvotes: 0

chelmertz
chelmertz

Reputation: 20601

There's a guide on mysql.com called Resetting the Root Password: Windows Systems.

Upvotes: 9

Related Questions