Access denied for user ‘pmauser’ when connecting to MySQL server in PHP code

I am trying to connect to a MySQL database from my PHP code using the mysqli_connect() function. However, I am getting the following error message in the browser :

Fatal error: Uncaught mysqli_sql_exception: Access denied for user
‘pmauser’@’localhost’ (using password: YES) in
C:xampphtdocsecommincludesdbh.inc.php:8 Stack trace: #0
C:xampphtdocsecommincludesdbh.inc.php(8):
mysqli_connect(‘localhost’, ‘pmauser’,
Object(SensitiveParameterValue), ‘phpproject01’) #1
C:xampphtdocsecommincludessignup.inc.php(11):
require_once(‘C:xampphtdocs…’) #2 {main} thrown in
C:xampphtdocsecommincludesdbh.inc.php on line 8

I have verified that the username and password are correct, and that the user ‘pmauser’ has all privileges and access to the ‘phpproject01’ database. I am running the MySQL server on port 3306, and I have checked my firewall settings to ensure that the port is open.

Here is the code I am using to connect to the database:

$serverName = "localhost";
$dBUsername = "pmauser";
$dBPassword = "sensitive";
$dBName = "phpproject01";

$conn = mysqli_connect($serverName,$dBUsername,$dBPassword,$dBName);

if(!$conn){
    die("Connection failed: " . mysqli_connect_error());
}

im running this on xampp

What could be causing this error, and how can I resolve it? Any help would be greatly appreciated.