Can't connect to my database - access denied

I am trying to connect to a database, but it I am getting denied. The error message I get is:

Connect Error (1045) Access denied for user ‘root’@‘localhost’ (using password: NO)

The code I am using to connect is:

$db = new mysqli($config["mysql"]["host"], $config["mysql"]["username"], $config["mysql"]["password"], $config["mysql"]["database"]);

The values for for the $config array are (password changed for security reasons):

$config["mysql"]["username"] = "steam";
$config["mysql"]["password"] = "dummy_value";
$config["mysql"]["database"] = "steam";
$config["mysql"]["host"] = "localhost";

I don’t understand why it’s trying to use ‘root’ as I have specified a specific user. It also says ‘using password: NO’, why?

I have double checked the database itself - it’s there as I can access it in phpMyAdmin

You seem to be overcomplicating things with "$config[“mysql”][“username”] = “steam”; " etc.
Anyway have you tried hardcoding your values into the $db = new mysqli( ) line?

Hardcoding the information worked! This led me to believe that it wasn’t reading the $config array, which was true. The $config array was in another file, which was not properly being included. It works as intended now. Thanks for the help!