Thursday, April 24, 2008

Reset User Account Password Example for MySQL

Recently I upgraded a legacy application on my server. After the upgrade, I had to reset a user account's password to match the one in the application's configuration file. Luckily, MySQL provides a utility to handle this fairly straightforward task. Here is the syntax and a couple examples.

mysql> use mysql;
Database Changed
mysql> set password for 'elforum'@'localhost' = password('98m4@9er');
Query OK, 0 rows affected (0.00 sec)
mysql> set password for 'mysysad'@'localhost' = password('950v4.Kr');
Query OK, 0 rows affected (0.00 sec)

mysql> select user, password from user;
+---------------+-------------------------------------------+
| user | password |
+---------------+-------------------------------------------+
...
| elforum | *EAE7DE143B1B9598745AD571885A98E723ABE9056 |
| mysysad | *Ebe7D596878627EDD581EADEFSA98E723ABE9C58 |
...

3 comments:

Erek said...

Sure hope those aren't your real SQL passwords :) If so, you can look at the same post for instructions on how to change them.

Good to see people finally knocking out old_passwords

--Erek

esofthub said...

The examples (login/password) are not, but I thought someone might ask me. They do look real. :)

Irinel said...

Thanks a lot!