Here is the solution for the error:
mysqli_connect(): (HY000/1045): Access denied for user (using password: YES)
Solution:
Make sure that your password doesn't have special characters and just keep a plain password (for ex: 12345), it will work. This is the strangest thing that I have ever seen. I spent about 2 hours to figure this out.
Note: 12345 mentioned below is your plain password that you would like to set for the below username.
GRANT ALL PRIVILEGES ON dbname.* TO 'yourusername'@'%' IDENTIFIED BY '12345';
FLUSH Privileges;