309: How to find your Drupal 7 database name
When you install Drupal 7 using the Softaculous installer tool, settings such as the database name are automatically generated for your installation. Although the database name is listed on the installation information page, most people do not keep track of it. Later on, when performing specific maintenance, troubleshooting, or needing to change something that the Drupal back office does not handle, they may need to access the database directly. As most hosting accounts use more than one database, this can be confusing. Below are instructions on how to locate the exact database name used by your Drupal 7 installation.
Finding the database name for your Drupal 7 site
- You will first need to log into your cPanel dashboard.
- Next, from the cPanel dashboard, locate and enter the File Manager.
- Once in the File Manager, locate the root folder for your Drupal application. If you are using Drupal for your main domain, then the folder you want to be in is the public_html folder. If you are using Drupal for an addon domain, then it will be in a subfolder. For instance, if example.com is your addon domain using Drupal then it will be found under the public_html/example.com folder.
- Now that you have found the root folder for your Drupal installation, look for the configuration file by going to the sites and then the default folder. For example, for your main domain, you will be under the public_html/sites/default path. Look for the file named settings.php. Highlight the file and click on the Edit icon located in the toolbar across the top of the screen. You will also be presented with an additional popup, click the Edit button on that also to open the file editor.
- This brings you to the actual editor so you can see the code and settings Drupal uses. The database settings are found after a giant block of commented text, around line 208. You will see a group of settings, one has the database name. The line appears similar to the one below:
'database' => 'userna5_drpl123',The database name is made with two parts, the username and the actual database name. From the example given above, the username portion is userna5 and the database name is drpl123.
- Be sure to note the database name. Write it down in a safe place if desired. This is the name you will look for when you are managing the database via your phpMyAdmin tool.
‹Section 3: 311: Fixing the "An unrecoverable error occurred" error in Drupal
›Section 5: 308: Making a duplicate Drupal test site
You are NOT logged in. You can still browse our Support Center.
To participate within our Community Support Forum: