Change MySQL User Password

If your need to change the password of an existing MySQL user, follow these steps;

Log into MySQL

mysql -uroot

connect to the mysql table

use mysql;

change the password for the user (eg tom)

update user set password=PASSWORD("NEW-PASSWORD-HERE") where User='tom';

You can see what permissions a user has using this command

show grants for "tom";

or create a new user with

create user "tom" identified by "PASSWORD-HERE";
grant all on \*.\* to tom with grant option;

Use drop to remove a user;

drop user "tom";

And finally, sometimes you need to flush the privileges cache to make the changes you have made take place

flush privileges;

Leave a Reply