Did you create the database?
Be sure that in MySql you
1 - created the database
2 - created a user
3 -added the user to the database (go back to MySql and find the Add user
select the user and database, and then Add user to database)
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.