In MySQL, password can be change by various method. Here I am using two methods:-
- By using command line
- By using mysql command prompt
If you have already a password, then the old password will be your password which is already set for user root. After the flush privileges it will automatically reload the updated password.
Reset password in MySQL
[divider]
Method 1: By using command line
The basic steps for open a command line are:
- GoTo start menu
- Enter cmd (a command line is opened).
- Enter cd "c:\program files\MySQL\MySQL Server 5.0\bin"
- c:\program files\MySQL\MySQL Server 5.0\bin > mysql –u root –p
- Enter password: //if you have already a password then write here otherwise blank
- Mysql> use mysql ;
- Mysql> update user SET password="" where password="old password" and user="root";
- Mysql> flush privileges;
Method 2: By using mysql command prompt
The basic steps for reset password using mysql command prompt are:-
- Mysql> use mysql ;
- Mysql> update user SET password="" where password="old password" and user="root";
- Mysql> flush privileges;
After performing all steps restart your system.
Reset password in Wamp Server
[divider]
Method 1: By using command line
- GoTo start menu.
- Enter cmd.
- Use cd "wamp\bin\mysql\mysql5.5.24\bin"
- C:\wamp\bin\mysql\mysql5.5.24\bin>mysql -u root -p
- Enter password: //if you have already a password
- Mysql> use mysql ;
- Mysql> update user SET password="" where password="old password" and user="root";
- Mysql> flush privileges;
Method 2: By using mysql command prompt
1) Mysql> use mysql ; 2) Mysql> update user SET password="" where password="old password" and user="root"; 3) Mysql> flush privileges;
NOTE:-
After perform all above process change in below file :-
1) C:\wamp\apps\phpmyadmin3.5.1\config.inc
2) In config.inc search for line $cfg[‘Servers’][$i][‘password’] = ‘ ‘ and put here your password.
3) Put wamp server online and restart all services.
4) Restart your system after performing all tasks.