To connect to MySQL database, you neeed the following pieces of information.
1. Hostname
Use localhost as hostname at all time. If localhost does not work, use 127.0.0.1
2. Username
This is the user who has privileges to access the database and make changes to it. In cpanel, this user is normally created to include the cpanel username as well. Eg if your cPanel username is example, then the database user will be something like example_dbuser. Here’s how you create a database user:
a) Access cpanel and scroll to MySQL Databases. Click it
b)Scroll down to MySQL Users. Select a username and password. NB: Note this password as you will need it in your database connection script.
c) Click Save.
3. Database name.
You need to first create a database in MySQL databases link before it can appear in phpMyAdmin. To create one:
a)Access cpanel and scroll to MySQL Databases. Click it
b)Under Create Database, enter the name of your database. Note that, like MySQL users above, the database will have the cpanel username prepended to it.
c) Click Create.