This site utilizes JavaScript to function correctly. Looks like it's disabled on your browser. Please enable it for your best experience.

For instructions on enabling JavaScript, click here

Skip to main content

Just Host Web Hosting Help

Connecting Scripts to MySQL Databases

In order for your MySQL database to work as intended, it will need a script calling or querying the database for the information it stores. In order to do this, you must connect your script to the database with the use of a configuration file. If you are not sure where your configuration file is, check this list of different scripts to find its location: Location of Script Configuration Files

Configuration Settings:

Database driven scripts, such as Wordpress, WHMCS, and Joomla, will generally have a default configuration file ready for you to edit with the appropriate information. Below you will find examples of what this access information will look like:

Host name = localhost (literally put localhost)
Database name = (cpanelUsername_databaseName)
Database username = (cpanelUsername_databaseUsername)
Database password = (whatever you picked)

WordPress Example:

Username = joe1337 , Database name = joe1337_wrdp1 , Database-user name = joe1337_wp1 , Database-user password = eHTb7%Pxa9

// ** 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');

Note: When you move databases to our servers, the database name and username may change. This change must be updated in your script code. (The database name and username can be found in the "MySQL Databases" tool under the "Databases" category of your cPanel.)

On shared servers, the database user name cannot be changed to something without the cPanel user name in it. This is to keep database names and usernames from conflicting with other people on the server.

While it is possible for someone to use their cPanel username and password to connect to the database, we NEVER recommend doing this because every time you change or reset your cPanel password your databases will stop working and need their configuration files updated.

If you need to connect to your database remotely using an application, please see our related articles on Remote Database Connection Setup and Managing Databases with Applications.

Knowledgebase Article 227,554 views bookmark tags: database mysql scripts


Was this resource helpful?

Did this resolve your issue?


Please add any other comments or suggestions about this content:





Recommended Help Content

How can I connect to our MySQL database from Dreamweaver?
Knowledgebase Article 258,672 views tags: connecting database dream mysql weaver

This article will explain MySQL database and user creation and deletion, and explain how to assign a user to a database.
Knowledgebase Article 859,451 views tags: creation database mysql

This article will explain how to change the password for a database in the event that the original password is lost.
Knowledgebase Article 249,953 views tags: database mysql password

Related Help Content

I cannot connect to my database locally or remotely, do I have the correct server, username and password?
Knowledgebase Article 324,304 views tags: connect disconnected hostname mysql user

I am prompted to set a new MySQL password. What does this mean and how do I change it?
Knowledgebase Article 236,312 views tags: connect database mysql password phpmyadmin username

This article will go over different application available for remote connection to your databases.
Knowledgebase Article 231,710 views tags: database mysql

How do I remotely connect using a database management software?
Knowledgebase Article 1,161,826 views tags: connection database mysqlfront remote

This article will instruct you how to export a database from the command line (SSH).
Knowledgebase Article 850,585 views tags: database mysql ssh

This article will instruct you how to import a database from the command line (SSH).
Knowledgebase Article 763,450 views tags: database mysql ssh

How do I make my MySQL database compatible with the version you provide?
Knowledgebase Article 234,687 views tags: compatible database mysql

How to restore MySQL databases using the Site Backup & Restore tool
Knowledgebase Article 241,165 views tags: backup database mysql restore site

** Google ad credits are only available to customers in the United States, Canada, and the United Kingdom at this time.

¹ VAT (Value Added Tax) is not included in our advertised price and will be charged separately and itemized on invoices and billing information. Standard VAT rates based on EU Member State regulations may apply. Learn more.