- If you have never set a “root” password for MySQL, the server does not require a password at all for connecting as “root”. However, this is insecure.
- If you know the “root” password, but want to change it.
- If you set a “root” password previously, but have forgotten it, you can set a new password. The following sections provide instructions for Windows systems.
You can try different methods like uninstalling MySql & reinstall it. But while reinstalling, it will ask previous password. To avoid this I will tell you one simple method to change MySql password without knowing previous password & save our work as it is.
Steps 1. Stop MySql service.
For that Right click on task bar --> Start Task Manager -->
Start Task Manager |
Services -->
Select Services |
MySQL --> Right Click --> Stop
Select MySQL service |
Stop MySQL service |
Step 2:-
Create .txt file contain following contain where ‘nikhil’ is new password for your MySQL. You can change this as per your requirement.
Save this file in C drive and name it as mysql-init
.txt file |
Step3:-
Open Command Prompt:- Press windows key+R --> Enter cmd --> OK
start RUN |
You will see following window.
Start Command Prompt |
Go to root directory. By using following steps.
Go To Root Directory |
Then you have to write following command in command prompt.
"C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld.exe" --defaults- file="C:\\Program Files\\MySQL\\MySQL Server 5.1\\my.ini" --init-file=C:\\mysql-init.txt
And then press enter.
Execute command |
Now you can log in into MySql using ‘nikhil’ as password.
LogIn MySQL with new Password |
Note:- While performing all above activity you have to log in as Administrator.
I've tested this on MySQL Server 5.1 Only using Windows 7.
No comments:
Post a Comment