There was a problem loading the comments.

What Are My Database Credentials?

Support Portal  »  Knowledgebase  »  Viewing Article

  Print
Your database credentials will comprise of a hostname, your database name and your database user, which is prefixed with your account name. In this article, we'll provide an example what a database config should include and where you can get this information from.

Your Database Hostname

Your database hostname credential will always be 'localhost'. Therefore in the connection config, this should include:
/** MySQL hostname */
define('DB_HOST', 'localhost');

Your Database Name and Database User

If you know that you have a database on your account but you are unsure what the database name is or what database user has access, you can review this via the control panel. Log into your cPanel account. If you are unsure on how to do this, please view the following help article - 'How to log into cPanel'. alt text Scroll down to the 'Databases' section and choose 'MySQL Databases'. alt text At the top under the 'Current Databases', you should find your database listed. Note that this includes the database name under the 'Database' heading and the database user under the 'Privileged Users' heading. alt text We therefore now know that our database credentials consist of our account name (hpdemouk in this example) followed by an underscore and the database name (new in this example). Coincidentally, our database user is the same. Therefore our database config will now also include:
/** The name of the database */
define('DB_NAME', 'hpdemouk_new');

/** MySQL database username */
define('DB_USER', 'hpdemouk_new');

Your Database Password

A database does not have a password, only the database user that has access does. If you know your password, add the following line to your database config replacing the password example with your actual password.
/** MySQL database password */
define('DB_PASSWORD', 'PASSWORDEXAMPLE');
If you are not sure what this password is, you can change the database user password. Still in 'MySQL Databases', scroll further down to the 'Current Users' section. Select the 'Change Password' option on the database user as noted from earlier. alt text
Type in your new password for the database user in the 'Password' box and repeat again in the 'Password (Again)' box. Note that there's a 'Password Generator' option if you would like the system to generate you a strong new password. alt text
Once your new password has been entered, complete the process by choosing the 'Change Password' option. alt text Now update the database config with the new password that you've set by adding this line:
/** MySQL database password */
define('DB_PASSWORD', 'NEWPASSWORDEXAMPLE');

Full Database Credentials

Your database config should consist of:
/** MySQL hostname */
define('DB_HOST', 'localhost');
/** The name of the database */
define('DB_NAME', 'youraccount_yourdatabasename');
/** MySQL database username */
define('DB_USER', 'youraccount_yourdatabaseuser');
/** MySQL database password */
define('DB_PASSWORD', 'PASSWORDEXAMPLE');

Share via
Did you find this article useful?  

Related Articles

© Eco Hosting