GRANT ALL PRIVILEGES ON * . * To 'JKR'@'%' IDENTIFIED BY "";
$con = new PDO("mysql:host=127.0.0.1;dbname=jkr;charset=utf8", "JKR", "");
Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]  Access denied for user ''@'localhost' to database 'jkr'' in C:\xampp\www\jkr\core\connect.php:6
Access denied for user ''@'localhost'
Most likely you have an anonymous user
''@'localhost' on your system. An anonymous user is a user where the name is ignored.
If you connect to MySQL with
JKR coming from
localhost it will match you with the anonymous user.
You can check using
SELECT User, Host from mysql.user;
See https://dev.mysql.com/doc/refman/5.7/en/connection-access.html for a detailed discussion about the way MySQL matches users and pemissions.