When working with ecommerce programs such as OpenCart, the vast majority of features and settings are taken care of in the administrative dashboard. There will come a time, however, when you will need to access or interact with the database directly, most often through some sort of troubleshooting. When this happens, you will need to know the exact database name that your OpenCart installation uses in order to interact. Working with the wrong database will not help your OpenCart application and could break another application as well. The following steps will guide you in how to locate the correct database name for your OpenCart application.
Finding the database name for your OpenCart application
- First, log into your cPanel dashboard.
- Once inside the cPanel, you will need to enter the File Manager.
- After entering the File Manager, navigate to the root folder for your OpenCart store. In our example, the folder is named opencart and is under the public_html root folder. This makes the folder path public_html/opencart.
- Under the root folder for your OpenCart store, locate and enter the folder named admin.
- Once inside the admin folder, look for the file named config.php file. To open the file, highlight it and click on the Edit icon located in the toolbar across the top.
- Once you open the file you will see many settings. Look for the line of code with DB_DATABASE in it. You will see the database name in the right side of the code line. In our example, the database name would be _opencrt1. The prefix will always be your cPanel username, in this case it is userna5. You can see a sample line of code below:
define('DB_DATABASE', 'userna5_opencrt1');
- Be sure to write down the database name so you can remember it. Now you can locate the particular database to use for editing no matter how many you have in your account.
great work