How to find out Vesta CP MySQL root password

As you already knew it that Vesta CP  not directly show you Mysql root password right after the installation. So this is how you can find out default VestaCP MySQL root password and the correct safe way to change it .

What’s VestaCP MySQL root password?

By default, The password is stored at:

/usr/local/vesta/conf/mysql.conf

So to find out what’s the password you can simply open up that file using your favorite text editor

nano /usr/local/vesta/conf/mysql.conf

From here you can note down the password in notepad.

Changing MySQL root password in VestaCP

Basically you can simply use usual way to change MySQL root password but that’s not the case with Vesta CP. There are another files you have to alter so Vesta CP can still run properly even after password changing.

To change the password use this command:

mysqladmin -u root -pOLDPASSWORD password 'NEWPASSWORD'

Replace OLD PASSWORD with the MySQL root password you get from mysql.conf file above. Also replace NEWPASSWORD with the new password you like, just make sure to noted down.

Once done, try login back to MySQL server as root using the new password you’ve just defined:

mysql -u root –pnewpassword

Now open up mysql.conf file once again and replace your old password with your new password:

nano /usr/local/vesta/conf/mysql.conf

Save changes and exit the editor.
Next, we have to change old mysql password stored in my.cnf:

nano /root/.my.cnf

Replace that with the password you defined in step 1.

That’s all there is to do and it is that simple to find MySQL root password in Vesta CP .

Hopefully that helps and do comment below sharing your thoughts and experiences .