How to Find the Database Password of Your WordPress Site

Last updated on
Feb 17, 2024

Do you want to migrate your WordPress site to a new hosting? If yes, then you need to configure the database in order to make your WordPress work properly. In the WordPress system, all the main configurations — including database — are stored in a file named wp-config.php.

You can edit this file to tailor the database information on your new hosting after you are done transferring all WordPress files from your old hosting to your new hosting, as well as importing the database tables. You can read our previous article for more detailed instructions on how to migrate your WordPress site to a new hosting.

The wp-config.php file itself is located on the root directory of your WordPress installation (public_html in most cases). So, to access the file, first, login to your hosting panel and open the file manager. Navigate to the public_html directory. You should find the wp-config.php file here. Open the file once you have found it.

Once the file opens, you can find the following line:

define( 'DB_PASSWORD', 'yourdatabasepassword' );

The text “yourdatabasepassword” on this line is the database password of your WordPress site. You can replace this password with the new password of your database if you are migrating your website. Above and beneath this line, you can also find the username as well as the hostname of your database.

A little note. If you have never edited the wp-config.php file and afraid of making a mistake, it would be great to back up the file first before you edit it.

This page may contain affiliate links, which help support the project. Read our affiliate disclosure.

Aliko Sunawang

Aliko is a professional blogger and web creator. He has been blogging with WordPress since 2012. In his spare time, he loves going out to take some photos.

One theme, unlimited projects.