Change root password in MySQL

Needed to set a MySQL root password. Found this article which suggested a way when no password is yet configured:

mysqladmin -u root password NEWPASSWORD

And a way when a password is already configured:

mysqladmin -u root -p'oldpassword' password newpass

Note: you use ‘mysqladmin’ not ‘mysql’.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.