MySQL change/add password for user

Log into mysql

mysql -u root -p

List users

select User,Host from mysql.user;

Set password

set password for 'root'@'localhost' = PASSWORD('password');

On new versions of MySQL you may need to use

alter user 'root'@'localhost' IDENTIFIED BY 'password';

Leave a Reply

Your email address will not be published. Required fields are marked *