Apparently, quite a number of people are looking into my humble website trying to find out how to change a password of an existing user. Doing this is easy in Oracle with a ALTER USER command. In MySQL, it is different in such a way that you need to update a table. Here’s the command.


UPDATE mysql.user
SET password = PASSWORD('mynewpassword')
WHERE user = 'kwatog';

FLUSH PRIVILEGES;

An alternative (and apparently official one) is by using the syntax below.

SET PASSWORD [FOR user] =
{
PASSWORD('some password')
| OLD_PASSWORD('some password')
| 'encrypted password'
}

Example :

SET PASSWORD 'kwatog'@'localhost = PASSWORD('mynewpassword')

Still can’t believe? Go head to the official documentation of MySQL at the following URL.
http://dev.mysql.com/doc/refman/5.0/en/set-password.html

Comments are closed.

Post Navigation