Verdant TCS

Change password of a database user

< 1 minute

In the highly unlikely event that you need to change the password of a website’s database, this article will walk you through how to do so.

For this, you’ll need to connect to your server – if this is your first time, please see the following articles to get started:

Step 1. Generate your SSH Key

Step 2. Add your SSH Key to vCanopy (also see Add default SSH Keys)

Step 3. Connect to your server by SSH as Root user (we like and use Termius)

Step 1. Login to MySQL

The following command will directly log you into MySQL. Simply copy and paste it and hit enter: 

gp mysql login root

Step 2. Update your Site’s MySQL User Password 

Copy and paste the following, and edit the highlighted parts in red to match your website’s database user name and the new password you want to set (you can view this inside your wp-config.php file inside your websites customizer):

ALTER USER 'website-db-user-here'@'localhost' IDENTIFIED BY 'new-password-here';

Exit MySQL with:


Step 3. Update your wp-config.php file

Your wp-config.php file exists inside your websites root directory. You can edit it with the following command (replacing “site.url” with your website’s URL):

nano /var/www/site.url/wp-config.php

Edit this section:

/** MySQL database password */

Then save the file with CTRL+O followed by Enter. Exit nano with CTRL+X.

Your website’s database password has now been updated. Visit your website and confirm all is working correctly. 

Step 4. Reset PHPMyAdmin Credentials

To finish up, you’ll now need to run the following command to update PHPMyAdmin (replace site.url with your actual site URL): 

gp site site.url -dbcreds

Search the Knowledge Base

New to vCanopy?

Get started with our FREE Core plan today! We bring the software, you bring the hardware.