开发者

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

The开发者_StackOverflow社区n 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!


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!


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


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.


  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.


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜