โ๏ธ Connect Database-Driven Scripts to Your MySQL Database
Database-driven systems like WordPress, WHMCS, and Joomla use a standard configuration file where you enter your database details. Below youโll find an example of how to set this up.
๐ Your Database Details
Hostname:
127.0.0.1
orlocalhost
Database Name: Created in cPanel โ MySQL Databases
Database User: Created in cPanel โ MySQL Databases
Database Password: The password you chose when creating the user
You can find your MySQL users and password using the following guide.
๐ WordPress Example
Hereโs how a WordPress configuration might look:
Your details:
Username:
joe1337
Database Name:
wrdp1
Database User:
wp1
Password:
eHTb7%Pxa9
In wp-config.php:
// ** MySQL Settings ** // /** The name of the database for WordPress */ define('DB_NAME', 'joe1337_wrdp1'); /** MySQL database username */ define('DB_USER', 'joe1337_wp1'); /** MySQL database password */ define('DB_PASSWORD', 'eHTb7%Pxa9'); /** MySQL hostname */ define('DB_HOST', 'localhost');
โ ๏ธ Important!
While it is technically possible to connect using your cPanel username and password, we do not recommend it. Each time you change or reset your cPanel password, your databases will stop working until the configuration files are updated.
โ Done!
Now you know how to connect your scripts, such as WordPress, to your MySQL database via the configuration file.