How to Check Which Database Your WordPress Website Uses

A WordPress website stores most of its content and settings in a MySQL database.

If you need to restore a database, export a database, troubleshoot an error, or check website settings, you may need to know which database your WordPress website uses.

This guide explains how to check the database name used by a WordPress website.


Why Would I Need to Know the WordPress Database Name?

You may need to know the database name if:

  • You want to restore a database from JetBackup.
  • You want to export a WordPress database.
  • Your website shows a database connection error.
  • You are moving a WordPress website.
  • Your developer asks for the database name.
  • You have more than one database in DirectAdmin.
  • You need to check the database in phpMyAdmin.

Where Does WordPress Store Database Details?

WordPress stores database connection details in a file called:

wp-config.php

This file is usually located in the main WordPress installation folder.

For many websites, this is inside:

domains/yourdomain.co.za/public_html

Replace yourdomain.co.za with your own domain name.


Step 1 – Log Into DirectAdmin

Open your browser and visit: https://cp.yourdomain.co.za (Replace yourdomain.co.za with your own domain name.)

Enter your DirectAdmin username and password.

Click: Log In


Step 2 – Open File Manager

Once you are logged into DirectAdmin, open File Manager.

Click: System Info & Files

Then click: File Manager


Step 3 – Open the WordPress Folder

Open the folder where WordPress is installed.

For most main websites, click: domains

Then click: yourdomain.co.za  (Replace yourdomain.co.za with your own domain name.)

Then click: public_html

If WordPress is installed in a sub-folder, open that folder instead.

Example:

public_html/blog


Step 4 – Locate the wp-config.php File

Inside the WordPress folder, look for the wp-config.php file.

Locate: wp-config.php

This file contains the database connection details used by WordPress.


Step 5 – Open or View wp-config.php

Open the file carefully.

Click: wp-config.php

Then click: Edit

or

Click: View

The wording may differ depending on your DirectAdmin version.

Do not change anything unless you know exactly what you are editing.


Step 6 – Find the Database Name

Look for the line that starts with:

define( 'DB_NAME',

The database name appears on this line.

Example:

define( 'DB_NAME', 'username_wp123' );

In this example, the database name is:

username_wp123


Step 7 – Find the Database User

You can also find the database user in the same file.

Look for the line that starts with:

define( 'DB_USER',

Example:

define( 'DB_USER', 'username_wpuser' );

In this example, the database user is:

username_wpuser


Step 8 – Close the File Without Saving Changes

After checking the database details, close the file.

If you did not make any changes, do not save the file.

Changing this file incorrectly can break your WordPress website.


Step 9 – Check the Database in DirectAdmin

You can now compare the database name in DirectAdmin.

Click: Account Manager

Then click:Databases

Look for the database name shown in wp-config.php.

Locate: Database name, example: username_wp123


Step 10 – Open the Database in phpMyAdmin

If needed, you can open phpMyAdmin to view the database.

Click: Account Manager

Then click: Databases

Then click: phpMyAdmin

In phpMyAdmin, select the database name shown in wp-config.php.


Important Notes

Please keep the following in mind:

  • WordPress database details are stored in wp-config.php.
  • Do not edit wp-config.php unless you know what you are doing.
  • The database name and database user may be different.
  • Choosing the wrong database during a restore can affect the wrong website.
  • Always make a backup before making database changes.
  • If your hosting account has multiple WordPress sites, each site may use a different database.

When Should I Contact HostworX Support?

Contact HostworX Support if:

  • You cannot find wp-config.php.
  • You are unsure which folder contains WordPress.
  • You cannot identify the correct database.
  • Your website shows a database connection error.
  • You need help restoring the correct database.
  • You accidentally changed wp-config.php.

Conclusion

You can check which database your WordPress website uses by opening the wp-config.php file in File Manager.

The DB_NAME value shows the database name used by WordPress.

Be careful when viewing this file and do not save changes unless you are sure they are correct.

  • directadmin databases, mysql databases, wordpress database
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to Access phpMyAdmin in DirectAdmin

phpMyAdmin is a web-based database management tool included with many hosting accounts. It...

How to Change a MySQL Database Character Set and Collation in phpMyAdmin

A MySQL database character set controls which characters can be stored in the database. A...

How to Create a MySQL Database in DirectAdmin

Many websites and applications require a MySQL database to store information such as website...

How to Import and Export a MySQL Database Using phpMyAdmin

phpMyAdmin allows you to export a MySQL database as a backup file and import a database backup...

What Is a Database User?

A database user is a login account that allows a website or application to connect to a MySQL...