what username and password should be given in settings.php file to connect my drupal site and db

Operating System & Version
cPanel & WHM Version
78.0 (build 38)


Feb 27, 2020
cPanel Access Level
Website Owner
Hi, I have already posted the thread regarding the settings.php file.
I need to know what username and password I need to add in the array of my connection string.

I have added a new user to my database in the MySQL databases.

In the settings.php file, I have added the new username and password in the data array and saved the file. When I run the site, I get 500 error. I don't know whether my db is connected to my site. As the site was running good in my local.

Please provide me the best instructions in how to add the username, password in the settings.php file and make my site live.
Don't know Why my username and password is not working.
I have also used default values [ i.e username: 'root' and password: '' ]

When I use default value I get below error,
PDOException: SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: NO) in lock_may_be_available()

Below is the code used in the settings.php file,
$databases = array (
'default' =>
array (
'default' =>
array (
'database' => 'sitename',
'username' => 'user',
'password' => 'password',
'host' => 'localhost',
'port' => '',
'driver' => 'mysql',
'prefix' => '',

Please help.
Thanks and regards.