Change MySQL Password



From Linux/Unix based systems, it is easy to set or change the root password. For setting this you need to open Terminal [ Applications->Accessories->Terminal  or Alt+F2 and type gnome-terminal ] and type the following:




SETTING THE ROOT PASSWORD:
If we are setting the password as 'passkey'


$ mysqladmin -u root password passkey


CHANGING THE PASSWORD:


If we are going to change the password 'passkey' to 'yekssap'


$ mysqladmin -u root -p'passkey' password 'yekssap'


Note: In the same way we can change password of any user of MySql.


Change Password in MySQL Prompt


Step 01 - Login to MySQL from Terminal as root


$ mysql -u root -p
and enter the password.
Note if there is no password leave the '-p' from above code.


Step 02 – Select MySQL database using 'use' sql command


mysql> use mysql;


Step 03 - Change password of the user using 'update' sql command.


Changing the password of the user developer to 'passkey'


mysql> update user set password=PASSWORD("passkey") where User='developer';


Step 04 – Reload Privileges


mysql> flush privileges;
mysql> quit;




Thats all folks ;-)

0 comments:

Post a Comment