Finding Your Database Name in WordPress

The vast majority of settings and features can be handled within the WordPress Administration section. However, when troubleshooting or under extreme circumstances, you may need to work directly with the database. Most hosting accounts contain more than one database, so you will need to know exactly which database to work with. This article will demonstrate how to locate the database name your particular WordPress installation is working with.

How to locate your WordPress installation’s database name

  1. First, you will need to log into your cPanel account.
  2. Next, you will need to open and enter the File Manager tool.
  3. From the File Manager, you will need to locate and move to the root folder for your WordPress installation. If you are using your main domain, the root folder will be public_html. If you are using a domain name, then it will be under public_html/domainname (For example, if is an addon domain, you will need to fin the public_html/ folder)
  4. Once in the root folder for your application, you will see many files. The find the wp-config.php file. Highlight the file and then click on the Edit button found in the toolbar across the top of the screen. A popup will appear on the screen, click the Edit button there as well.
  5. Once in the editor, you will see a lot of code regarding WordPress. Just past the code comments, around line 19, you will see the code for the database name. It appears like the example below:define('DB_NAME', 'userna5_wp123');
    The database name parameter is actually composed of two parts. In our example userna5_wp123, the first part is the cpanel username (userna5), and the second part is the actual database name (_wp123)
  6. Write down your database name in a secure location so you can remember it when you need to access it using the phpMyAdmin tool.

Shared hosting users needing more databases can upgrade your Business Hosting with within Account Management Panel (AMP) or consider a VPS hosting plan.

11 thoughts on “Finding Your Database Name in WordPress

  1. Is there an alternate way to find my database name rather then looking in the wp-config.php file folder? I have uploaded the wordpress installation so I am asked to edit the wp-config.php file and insert the necessary details including my database name. In other words I am unable to use the original method you mentioned since that information is not yet located there as it is waiting for my input.

    1. Joshua, if you have a cPanel server you can check the MySQL® databases that you have setup right from your cPanel using the “MySQL® Databases” icon.

  2. How can I know my MySQL hostname .

    I put there localhost as MySQL hostname  but it is showing ERROR ESTABLISHING CONNECTION when I open my website. All other parameters are correct but only problem is in MySQL hostname  I think.

    1. Hello Gorakh,

      Thank you for contacting us. You should use “localhost” if the database is on the same account as the website.

      If you are connecting to a remote SQL server, ensure you have added your IP to the firewall, and use a domain for the hostname, such as “”.

      Thank you,

  3. Hi,

    Do I have to change all the little URLs t hat are mentioned in plugins? It are hundreds of them. I also saw one named string-locator-results. It’s a terrible long file, does the url need to be changed in the entire file? So from to 

    1. Hello Andrew,

      The File Manager itself is located within the cPanel as mentioned in steps 1 and 2. Once inside and you have gotten the database name from the wp-config file, then you would visit phpMyAdmin in step 6. Please let us know if you have any more questions.

      Kindest Regards,
      Scott M

  4. User Login

    I’m using core sms for mobile outside the wordpress directory which is in core php

    I want to encrypt the password being sent into the database.

    Database is storing password format like this $P$BCi4dUmFr/uKKR8qy0AaksO3Cv8Qun/

    i’m using outside wordpress directory function md5([‘user_pass’]); it is storing format like ‘8b019af0a1de935cc5e76d804967d51a’ after set of logins it is changes to $P$BCi4dUmFr/uKKR8qy0AaksO3Cv8Qun/ which format i need use.please help me.

    1. I didn’t find a file manager in the location indicated. Unless it is called something else, there is no file manager in my phpmyadmin location. If it is called something else, it would be nice to make a note so people like me don’t have to guess at terms.

    1. Hello edo,

      I’m not sure what you are asking. Both WordPress and Joomla have config files that list the database name in them. The database name is always in the same format (cpaneluser_dbname).

      Kindest Regards,
      Scott M

Was this article helpful? Join the conversation!