You get a bonus - 1 coin for daily activity. Now you have 1 coin

Changing a MySQL user's password

Practice



This topic is a cheat sheet on how to change the password of a user (any user) in the MySQL DBMS.

Method 1:

# mysqladmin -u username -p'oldpassword' password NEWPASSWORD

or

# mysqladmin -u username@'hostname' -p'oldpassword' password NEWPASSWORD


Method 2:

# mysql -u root -p
Password:
...

mysql> UPDATE mysql.user SET Password=PASSWORD('newpassword') WHERE User = 'username' AND host = 'hostname';

Something like that, roughly.
created: 2017-05-09
updated: 2026-03-09
360



Was this answer useful?
Choose a quick rating so we can improve the next answer for you.
How satisfied are you?


Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Databases - MySql (Maria DB)"

Terms: Databases - MySql (Maria DB)