Wednesday, December 9, 2009

How to Update or Change Password for a Single User in MySQL and Reload Privileges

MySQL stores usernames and passwords in the user table inside the MySQL database. You can directly update a password using the following method to update or change passwords:

1) Login to the MySQL server, type the following command at the shell prompt:

$ mysql -u root -p

2) Use the mysql database (type commands at the mysql> prompt):

mysql> use mysql;

3) Change password for a user:

mysql> update user set password=PASSWORD("newpass") where User='YOUR-USER-NAME';

4) Reload privileges:

mysql> flush privileges;
mysql> quit


*the above script works only with PHP or pearl scripting*

No comments:

Post a Comment