Skip to content

root

Change Root Password MySQL

I don’t know how many times I have had to look up this information in the past. In hopes of learning-through-writing I’ve decided to publish these methods of recovering or resetting the MySQL root password. Set Initial Password If you’ve just installed MySQL and have never set the root password a password is not yet needed. Until one is defined you should be able to access your database(s) without the password. To set a password for the first time you can use: mysqladmin -u root password NEWPASSWORD Update Root Password If you want to update or change the existing root password you can use: mysqladmin -u root -p'oldpassword' password newpass You should note that this will require that you know the current password. Recover Lost Password If you have completely lost the MySQL root password and need to reset it you can. This will require short downtime on your database(s). Read more