Can someone please help me figure this error out?

Access denied for user 'username'@'localhost' (using password: YES)

I just created a new database and I have the most simple database connection string that I could have seen below but when I run it, it fails with the above error. I am certain that the username, password, and database name is correct. I have also made certain to give the username all privileges. The database is at Go Daddy if that matters.

$con = mysqli_connect("localhost","$username","$password","$db_name");

if (mysqli_connect_errno()) {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
    echo "Success";