-2

How can I debug this problem? I am getting this error:

Uncaught PDOException: SQLSTATE[HY000] [1045] Access denied for user 'Devon'@'localhost' (using password: YES) in D:\XAMPP\htdocs\phpdasar\UjiCobaPDO\login.php:31 Stack trace: #0 D:\XAMPP\htdocs\phpdasar\UjiCobaPDO\login.php(31): PDO->__construct('mysql:host=loca...', 'Devon', 'devon') #1 {main} thrown in D:\XAMPP\htdocs\phpdasar\UjiCobaPDO\login.php on line 31

halfer
  • 19,824
  • 17
  • 99
  • 186
  • 4
    You're using the wrong username/password/host - it's telling you that it can't log in to the MySQL server you've configured. _Why_ that is can depend on many factors, such as using the wrong authentication information, not having the user configured correctly in MySQL, not being allowed to login from the host you're attempting to log in from, etc. In this case I'm guessing wrong authentication information / non-existing user in MySQL. – MatsLindh Apr 21 '20 at 06:33

1 Answers1

1

It is no PDO issue. It's a MySQL thing. Are you sure, that you are using the correct password or the user is existing? And you need to make sure, that the user access rights to the database have been set, you are trying to access to.

Pleae also have a look at the docs: https://dev.mysql.com/doc/refman/8.0/en/access-control.html

dns_nx
  • 3,651
  • 4
  • 37
  • 66