Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

How to find your WordPress database details in cPanel

This guide shows you how to find out which database your WordPress site uses, and its user name.

Databases2 min read9 steps

Why do you need this?

WordPress keeps your posts, pages and settings in a database. A database is like a filing cabinet for your site's data. To back up, move or fix your site, you need to know which database it uses. WordPress stores these details in a file named wp-config.php. cPanel is the control panel for your hosting account, and it lets you open that file.

The four details

  • DB_NAME: the name of the database.
  • DB_USER: the user name that opens the database.
  • DB_PASSWORD: the password for that user.
  • DB_HOST: where the database lives. Often it is localhost, which means the same server.

Steps

  1. Log in to your client area. Open your hosting service and log in to cPanel.
  2. Under Files, click File Manager.
  3. Open the folder where WordPress is installed. This is often public_html.
  4. Find the file wp-config.php.
  5. Right-click it and choose View. Choose Edit only if you plan to change it.
  6. Look near the top for lines like these:
define( 'DB_NAME', 'account_wp123' );
define( 'DB_USER', 'account_wpuser' );
define( 'DB_PASSWORD', 'your-password-here' );
define( 'DB_HOST', 'localhost' );

The words in the second box of each line are your values. Write them down.

Warning: Do not share this file or its password with anyone you do not trust. Take a backup before you edit it. One wrong character can break your site.

See the database in cPanel

  1. Go back to cPanel and click MySQL Databases.
  2. Scroll to Current Databases.
  3. Find the name you saw in wp-config.php. It shows its linked user too.
Tip: If you forgot the password, you can set a new one under MySQL Users in cPanel. Then update DB_PASSWORD in wp-config.php to match. Both must be the same.

If the site runs from a different folder, look in that folder instead. Need help? Open a support ticket.

Quick recap

  • WordPress saves its database details in wp-config.php.
  • Open it with File Manager in cPanel.
  • Look for DB_NAME, DB_USER, DB_PASSWORD and DB_HOST.
  • Back up before any edit.