Your Drupal database name was originally created during the programs installation. Generally, this information is not needed after the initial install. However, if you ever need to work and interact directly with the database, particularly when troubleshooting, you will need to know the database name. Not knowing the exact database name can make things difficult if you have mutliple databases on your hosting account. The instructions below will explain how to discover your database name for your Drupal 7 website.
How to find database name for your Drupal 7 site
- Log into your cPanel dashboard.
- Next, from the cPanel dashboard, locate and enter the File Manager.
- Now that you are inside the File Manger, navigate to the root folder for your Drupal application. If you are using your main domain, then the folder you want to be in is the public_html folder. If Drupal is being used with an addon domain, then it will be in a subfolder. For instance, if example.com is your addon domain then the root folder will be your public_html/example.com folder.
- Once you are in the root folder installation, find for the configuration file by going to the sites and then the default folder. Using the main domain as an example, you will be under the public_html/sites/default folder path. Once there, look for the file named settings.php. Highlight the file and click on the Edit icon from the toolbar at the top of the screen. You will then see a popup box, click the Edit button on the box to open the file editor.
- Inside the file editor you will see the code and settings your Drupal site uses. The database settings are located after a giant block of commented text, around line 208. The line of code with the database name looks similar to the one below:
'database' => 'userna5_drpl111',
The database name is composed of two parts, the username and the actual database name. From the example given above, the username portion is userna5 and the database name is drpl111.
- Be sure to write down the database name in a safe place so you can find it later. This is the name you will look for when you are managing the database via your phpMyAdmin tool.