WP Umbrella Logo

How To Find WordPress Database Name: 2 Easy Ways

Medha Bhatt

Most of what you do in WordPress like publishing posts, updating plugins, changing settings happens through the admin dashboard. But behind the scenes, everything runs off a MySQL database. 

Each WordPress site is tied to a specific database. And if you’re running multiple sites on the same hosting account or were handed a site without documentation, it’s not always obvious which database belongs to which site. 

At that point, knowing your WordPress database name is essential. In this post, we’ll show you step-by-step how to find the database name your WordPress installation is using. 

Why You Might Need to Find Your WordPress Database Name

Understanding how to locate your WordPress database name is a practical skill that becomes valuable in several scenarios, such as:

Troubleshooting WordPress Issues: Knowing your database name allows you to investigate directly using tools like phpMyAdmin when your site encounters database-related errors. It can help identify corrupted tables or data inconsistencies that plugins can’t fix.

Working with Developers: If you’ve hired a developer to implement custom functionality or fix complex issues, they’ll often need database credentials.

Database Management: Sometimes, you’ll need to perform operations like optimizing tables, repairing corrupted data, or creating database backups outside of WordPress. Each of these tasks requires knowing which specific database contains your WordPress installation, especially on hosting accounts with multiple databases.

Migration and Cloning: When moving your WordPress site to a new host or creating a staging environment, you’ll need to identify and export the correct database. For that, you need to know your database name.

Custom SQL Queries: Advanced users might need to run custom SQL queries to extract specific information or make bulk changes that aren’t possible through the WordPress interface. The database name is required to connect to the correct database for these operations.

Also read: How to Backup WordPress Database

How to Find Database Name in WordPress

To find your WordPress database name, you’ll need to open the wp-config.php file. 

Wp-config.php is in your site’s root directory and stores key details WordPress uses to connect to your database—like the database name, username, password, and host.

There are two main ways to access it:

  • Through your hosting control panel (like cPanel or hPanel)
  • Using an FTP client (like FileZilla)

The method you choose depends on what you’re comfortable with or what your hosting provider offers. 

Method 1: Using cPanel’s File Manager

Most hosting providers offer cPanel access as part of their WordPress hosting packages. This built-in tool is the quickest way to find your database name without installing additional software.

Log in to your cPanel account. Enter your hosting credentials to gain access to the full control panel.

Locate the Files section near the top of the cPanel interface. Within this section, you’ll see the File Manager icon. 

How To Find WordPress Database Name - Use cPanel's File Manager

Click on it to open your website’s directory structure. File Manager opens to your account’s home directory by default, so you’ll need to navigate to where WordPress is installed. 

For most standard installations, this is the public_html folder, though if you’re running multiple sites or have installed WordPress in a subdirectory, you may need to navigate further.

Once inside your WordPress installation directory, you should see a list of files and folders that make up the WordPress core. Look for the file named wp-config.php, which is a critical configuration file that contains all database connection information. 

How To Find WordPress Database Name - cPanel

Right-click on this file and select Edit from the context menu. A warning may appear about editing files; acknowledge it to proceed to the editor.

Scroll down past the initial comments to find a section labeled MySQL settings or similar. 

Within this section, look for a line that begins with define (‘DB_NAME’, followed by your database name in quotes. The text between these quotes is your WordPress database name. 

For example, if you see define(‘DB_NAME’, ‘userna1_wp456’), then “userna1_wp456” is your database name.

Tips

Don’t make any changes in this file unless you know what you’re doing. A single typo could take down your site. Just view the database name, then close the editor without saving anything.

Method 2: Using an FTP Client

An FTP client, like FileZilla, provides a reliable alternative for situations where you don’t have cPanel access or prefer working with dedicated file transfer tools. It allows you to directly connect to your server and browse its file structure, much like you would navigate folders on your local computer.

To begin, download and install FileZilla from its official website. 

Once installed, open the application and look for the Site Manager option under the File menu. Here, you’ll create a new connection to your website’s server using the FTP credentials provided by your hosting company. 

These typically include a hostname (which is often your domain or server IP), username, password, and sometimes a specific port number. Enter these details carefully, as even small typos will prevent a successful connection.

After configuring your connection settings, click Connect to establish a connection with your server. The FileZilla interface displays your local files on the left side and the remote server files on the right. 

Navigate through the remote server directories until you reach your WordPress installation’s root folder. 

Like the cPanel method, this is typically within the public_html directory, though it might be in a subdirectory if you’ve installed WordPress in a custom location.

Once you’ve located the WordPress root directory, find the wp-config.php file among these files, right-click on it, and select View/Edit. This action downloads a temporary copy of the file to your computer and opens it in your default text editor. 

Unlike direct editing through cPanel, this method adds an extra layer of safety since changes aren’t automatically saved to the server unless you explicitly choose to upload the modified file.

With the wp-config.php file open in your text editor, scan through the contents to find the database configuration section. Look for the line that begins with define(‘DB_NAME’, followed by your database name in quotation marks. 

This value is your WordPress database name. You can also use your text editor’s search function (typically Ctrl+F on Windows or Cmd+F on Mac) to locate “DB_NAME” within the file.

As before, don’t save or modify anything in this file unless you’re absolutely sure.

Also read: The Ultimate Guide to Optimize WordPress Database

Conclusion

Finding your WordPress database name is a simple but essential task especially when troubleshooting, migrating your site, or working with developers. All it takes is locating the wp-config.php file and checking the DB_NAME value.

Keep this information secure but accessible for those rare occasions when database access becomes necessary.

FAQs About WordPress Database Name

1. Where is the WordPress database name stored?

The database name is stored in the wp-config.php file located in the root directory of your WordPress installation. You can access it via File Manager in cPanel or through an FTP client.

2. Can I change my WordPress database name?

Technically, yes but it’s not recommended unless you know exactly what you’re doing. Changing the database name involves creating a new database or renaming the old one, updating wp-config.php, and possibly updating user permissions. It’s easy to break your site if you miss a step.

3. Can I locate the database name for a multisite WordPress installation?

Yes. The process is the same—check the wp-config.php file in the root directory. Just note that all subsites in a multisite setup share the same database, but use different table prefixes.

4. What do DB_USER and DB_PASSWORD mean in wp-config.php?

These are your database credentials. DB_USER is the username WordPress uses to connect to the database, and DB_PASSWORD is the corresponding password. Never share or modify these unless necessary.