The normal steps to create and use a database are:
Be sure that in MySql you
1 - created the database
2 - created a user
3 -added the user to the database (this is the step most often forgotten)
Then to connect to the database in a script use:
host: localhost
database: yourCpanelName_databaseName
user: yourCpanelName_databaseUser
password: mypassword
* Note password is just as the password,
do not add the CpanelName to it.