Before You Start
You will need:
A MySQL database created in cPanel.
A MySQL database user.
The database user's password.
Access to your application's configuration file.
If you need to create a MySQL database first, see our guide to creating a MySQL database.
1. Find Your Database Details
Use the following details when configuring your application:
Hostname:
localhostDatabase Name: The database you created in cPanel → MySQL Databases
Database User: The user you created in cPanel → MySQL Databases
Database Password: The password you created for the database user
💡 Tip: Make sure the database user has been added to the database and has the required permissions.
2. Add the Details to Your Configuration File
The exact configuration file depends on the application you are using.
For example, WordPress uses a file called wp-config.php.
Example
Your database details might be:
Database Name:
joe1337_wrdp1Database User:
joe1337_wp1Database Password:
eHTb7%Pxa9Database Host:
localhost
In wp-config.php, the settings would look like this:
define('DB_NAME', 'joe1337_wrdp1'); define('DB_USER', 'joe1337_wp1'); define('DB_PASSWORD', 'eHTb7%Pxa9'); define('DB_HOST', 'localhost');
Replace the example values with your own database details.
⚠️ Important
We do not recommend using your cPanel username and password for your application's database connection.
If you change or reset your cPanel password, your application may lose access to the database until its configuration is updated.
Using a separate database user makes it easier to manage your database connection and credentials.
3. Check the Connection
After adding your database details:
Save the configuration file.
Open your website or application.
Check that it loads correctly.
If you receive a database connection error, verify the database name, username, password, and hostname.
Result
Your application is now configured to connect to your MySQL database using the database credentials in its configuration file.
