Recommended VPS Complete list of best VPS hosting providers.

[Quick Tip] How to Find Out Vesta CP MySQL Root Password

mysql-root-feat

This is how you can find out default VestaCP MySQL root password and how the correct safe way to change it – The password is generated randomly and stored at mysql.conf file. As you may already knew it that Vesta CP is by default not directly show you Mysql root password right after the installation. So many users are still confused when they are in need to login to mysql server as root.

What’s your VestaCP MySQL root password?

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 like Nano or vi:

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

It will appear like this:

mysql-vesta-password

the password is the one shown in PASSWORD=’randompassword. Note down that password or copy-paste it to Notepad.

Changing MySQL root password in VestaCP

Basically you can simply use usual way when you need too 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 after password changing. Here’s how:

Step 1 – Use this usual mysql command to change password:

mysqladmin -u root -pOLDPASSWORD password 'NEWPASSWORD'

Replace OLDPASSWORD with the real mysql root password you get from mysql.conf file above. Also replace NEWPASSWORD with the new password you wish, just make sure you can remember it or noted in down.

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

mysql -u root -pNEWPASSWORD

Step 3 – Open up mysql.conf file once again and replace your old password (the one generated by Vesta) with your new password:

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

Save changes and exit the editor which in Nano it is Control+O then Control+X.

Step 4 – Next, you have to change old mysql password stored in my.cnf:

nano /root/.my.cnf

my-cnf-password

replace that with the one you defined in step 1.

That’s all. You can now open PhpMyAdmin and login as root with password you’ve just created. Do not also forget to give it a test by creating new database via Vesta CP interface. I’m sure at some point you may need to know or change default Vesta CP mysql root password like what I did during Mysql Master – Slave replication setup. Subscribe to Servermom’s feed or follow me on Twitter to get faster update.

3 Comments

Add a Comment

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

Get more stuff like this
in your inbox

Subscribe and get interesting stuff plus faster updates to your email.