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:
- Uninstall MySQL using the uninstaller
- Delete
C:\Program Files\MySQL
- Delete
C:\Program Files (x86)\MySQL
- Delete
C:\ProgramData\MySQL
- Delete from any Users' AppData folders. Example:
C:\Users\rdoverby\AppData\Roaming\MySQL
- 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.
- First uninstall MySQL Server
- Delete MySQL Server Application Data folder at
C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.6
(Windows XP). - 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
精彩评论