Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
FREEDOM251

Freedom251 › Blog › DB_NAME

How to Find Your WordPress Database Name (DB_NAME)

By Freedom251 Team · · 8 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The authoritative database name for a WordPress installation is the value assigned to DB_NAME in that site’s wp-config.php file. Open the configuration file in the installation root and find a line like define( 'DB_NAME', 'example_database' );; the quoted value is the name WordPress is configured to use. If you can log in as an administrator, you can also read it at Tools → Site Health → Info → Database.

What the WordPress database name means

WordPress stores posts, pages, settings, users and other site data in a MySQL-compatible database. The database name is the identifier WordPress uses when it connects to that database. In the configuration file, it appears as the DB_NAME constant. The WordPress configuration template describes this value as “The name of the database for WordPress.” The setup screen describes it as “The name of the database you want to use with WordPress.”

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A database name is different from the database host, username and password. The host tells WordPress which database server to contact; DB_USER and DB_PASSWORD provide credentials; DB_NAME selects the database on that server. You normally need only the name when a host asks which database belongs to a site, when preparing a backup, or when diagnosing a connection error.

Fastest method: read DB_NAME in wp-config.php

Checking the configuration file is the most direct method because it shows the value WordPress itself is configured to use. You need access to the files for the specific installation, through your host’s File Manager, SFTP or SSH.

Using a hosting File Manager

  1. Sign in to the hosting account that contains the site.
  2. Open the host’s File Manager and browse to the WordPress installation root—the directory containing the site’s WordPress files.
  3. Locate wp-config.php. If the File Manager hides configuration files, enable its option to show hidden files.
  4. Open the file in the editor, or download a copy for viewing. Do not change the file merely to find the name.
  5. Search for DB_NAME. The relevant line normally has this form:
define( 'DB_NAME', 'example_database' );

The text between the second pair of quotes—example_database in this example—is the database name. Copy it exactly, including underscores, hyphens or any host-assigned prefix. Do not copy the quotation marks or the surrounding PHP syntax.

Using SFTP

  1. Connect to the same hosting account with an SFTP client.
  2. Open the directory for the site you are troubleshooting.
  3. Download wp-config.php or use the client’s safe view/edit function.
  4. Find define( 'DB_NAME', '...' ); and record the quoted value.

Make sure the SFTP directory belongs to the domain or installation in question. A single hosting account can contain several WordPress directories, each with its own configuration file.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Using SSH

If the host provides shell access, change to the site’s installation directory and print or search the file without editing it. For example:

grep DB_NAME wp-config.php

The output should contain the same define statement. If the command returns nothing, confirm that you are in the directory containing the correct wp-config.php; do not assume that the current directory is the site root.

Find the name in WordPress Site Health

When you can sign in to WordPress administration, Site Health avoids file-manager access. Learn WordPress recommends this route when one hosting account contains multiple databases.

  1. Sign in to the WordPress dashboard with an account that can view Site Health information.
  2. Open Tools → Site Health.
  3. Select the Info tab.
  4. Expand the Database section.
  5. Read the field labeled Database name.

This value is the database name WordPress reports for the running site. It is especially useful when several databases appear in a hosting dashboard and you want to associate the logged-in site with one of them. Treat the displayed value as sensitive operational information and share only the name when that is all another person needs.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Confirm a candidate database in phpMyAdmin

phpMyAdmin is useful when you have access to the host’s control panel but are unsure which listed database belongs to the site. It is a confirmation method: the definitive configured value remains DB_NAME in the site’s own wp-config.php.

Open the database list

  1. Sign in to the hosting control panel, such as cPanel or the host’s equivalent dashboard.
  2. Open phpMyAdmin.
  3. Review the database names shown in the left navigation.

Hosting providers often add an account or user prefix to database names. Do not infer a match from a domain name, directory name or a familiar-looking suffix alone.

Use WordPress tables as a check

If more than one database looks plausible, select a candidate and inspect its table list. Standard WordPress tables include tables such as wp_options and wp_posts. Finding those tables is evidence that the database contains WordPress data; it does not replace checking the matching site’s configuration file when you need certainty.

  • Likely WordPress data: the candidate contains recognizable WordPress tables, including examples such as wp_options and wp_posts.
  • Not enough evidence: a database name merely resembles the domain or project name.
  • Wrong candidate: the database has no WordPress tables or clearly belongs to another application.

Use read-only inspection. Do not rename, delete, empty or alter tables while you are only trying to identify the database.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use WP-CLI when you have shell access

WP-CLI provides a command-line fallback for administrators and developers who can access the server but do not want to open a browser-based control panel. Run commands from the WordPress installation directory so WP-CLI loads the intended site’s configuration.

Display the database name and size

wp db size

This command displays the database name and its size. The name shown is the database associated with the WordPress installation detected in the current directory.

Open the database console

wp db cli

wp db cli opens a MySQL console using the connection details from wp-config.php. It is useful when you need to inspect the connection directly, but simply finding the name does not require changing any data. Exit the console without running write operations if identification is your only goal.

When WP-CLI reports the wrong site

WP-CLI reads the configuration associated with the directory in which it runs. If the output surprises you, check the current path and locate that directory’s wp-config.php. On a server with several installations, run the command separately from each site’s own directory.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose the method that matches your access

Method Access required What it tells you Confidence Risk while reading
wp-config.php File Manager, SFTP or SSH The configured DB_NAME value for that installation Direct and authoritative Low if you only view the file
WordPress Site Health WordPress administrator login The running site’s reported database name Direct for the logged-in site Low; no file editing
phpMyAdmin Hosting dashboard access Candidate databases and their tables Confirmatory; verify against wp-config.php Low for viewing, higher if you edit tables
wp db size SSH and WP-CLI Database name and size for the current installation Direct when run in the correct directory Low when used for display only

Start with wp-config.php when you have file access. Use Site Health when you can log in but do not have hosting access. Use phpMyAdmin to distinguish among candidates, and WP-CLI when command-line access is your most convenient route.

How to identify the correct database on a busy server

The same server can host multiple WordPress installations. WordPress documentation defines DB_NAME as the name of the individual database created for that blog on the MySQL server specified by DB_HOST. Therefore, the answer belongs to the specific site you are troubleshooting, not to the server as a whole.

Match the site directory first

Begin with the domain, staging site or directory you actually need to repair. Open that installation’s wp-config.php, then record its DB_NAME. If you instead open a neighboring site’s file, every later comparison can point to the wrong database.

Compare the configured name with phpMyAdmin

Search the phpMyAdmin list for the exact configured value. If it is present, select it and look for WordPress tables such as wp_options and wp_posts. This two-part check—exact name plus recognizable tables—reduces the chance of choosing a similarly named database.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Teacher Record Book
  • Keep track of everything from attendance to test scores
  • Spiral bound
  • Measures 8-1/2" x 11"

Do not infer from a domain or directory

A domain, folder or database label can be descriptive, abbreviated or host-prefixed. None of those names is authoritative by itself. Use the site’s own DB_NAME setting or the corresponding Site Health value.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What to do when the names do not match

The value in wp-config.php is absent from phpMyAdmin

  • Confirm that you opened the correct WordPress installation directory.
  • Confirm that the hosting account is the same account associated with the DB_HOST value in that file.
  • Check for a typo when copying the database name; preserve every character.
  • Ask the web host whether the database is on a different account or server.

Do not replace DB_NAME with a guess simply because another database looks similar. Changing connection settings can take the site offline or connect it to the wrong data.

The database exists but does not look like WordPress

Open the candidate’s table list and look for recognizable WordPress tables, including examples such as wp_options and wp_posts. If they are missing, you may be viewing a database for another application or the wrong installation. Return to the matching wp-config.php and repeat the comparison.

You cannot obtain the connection details

WordPress’s setup screen advises contacting the web host when you cannot obtain the database connection details. The host can identify the account, server and database associated with the installation after verifying that you are authorized to receive the information.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Protect wp-config.php while finding the name

The file contains more than DB_NAME. It also contains DB_USER and DB_PASSWORD, which are connection credentials. Handle it as sensitive configuration data.

  • Share only the database name when that is all a colleague or support agent needs.
  • Do not paste the complete file into a public forum, ticket or chat.
  • When sending a screenshot, crop or redact usernames, passwords and other settings.
  • Prefer viewing or downloading the file over editing it for an identification task.
  • Keep any local copy secure and delete it when it is no longer needed.

Reading a name is normally a low-risk, read-only operation. Editing credentials, changing the host or renaming a database is a separate maintenance task that requires a backup and a verified recovery plan.

Can you find the database name without cPanel?

Yes. cPanel is only one possible route. You can use any of the following instead:

  • WordPress admin: Tools → Site Health → Info → Database.
  • SFTP or another host file manager: read DB_NAME in the installation’s wp-config.php.
  • SSH: search the file with grep DB_NAME wp-config.php, or run wp db size from the correct site directory.
  • Another hosting panel: open its phpMyAdmin equivalent and compare candidate databases with the configured name.

If you have none of these forms of access, the web host is the party that can provide or confirm the connection details.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Quick Recap

SaleBestseller No. 1
SaleBestseller No. 3
Bestseller No. 4
Teacher Record Book
Teacher Record Book
Keep track of everything from attendance to test scores; Spiral bound; Measures 8-1/2" x 11"
$4.89

Quick decision checklist

  1. Need the most authoritative answer? Open the target site’s wp-config.php and read DB_NAME.
  2. Can log in to WordPress but not the host? Use Tools → Site Health → Info → Database.
  3. Have several database candidates? Compare their exact names with DB_NAME, then check for WordPress tables such as wp_options and wp_posts.
  4. Have SSH? Run wp db size in the site directory, or use grep DB_NAME wp-config.php.
  5. Nothing matches? Recheck the installation directory and hosting account tied to DB_HOST; contact the host if the details remain unavailable.
  6. Sharing the result? Send only the database name, never the full configuration file or password.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

DB_NAMEphpMyAdminSite HealthWordPressWP-CLIwp-config.php

Leave a Reply

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

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.