Warning: mysqli_connect(): (HY000/1045): Access denied for user \'username\'@\'localhost\' (using password: YES) in C:\\Users\\xampp\\htdocs\\PHP_Login_Script
I had this error trying to connect with a different user than root I'd set up to limit access.
root
In mysql I'd set up user MofX with host % and it wouldn't connect.
MofX
%
When I changed the user's host to 127.0.0.1, as in 'MofX'@'127.0.0.1', it worked.
127.0.0.1