Error 1045 (28000): Access denied for user 'myuser'@'localhost' (using password: YES)
The fix was to specify the IP address when creating the user and granting it permissions:



CREATE USER 'demouser'@'127.0.0.1' IDENTIFIED BY 'p';



  Query OK, 0 rows affected (0.00 sec)


FLUSH PRIVILEGES;



  Query OK, 0 rows affected (0.01 sec)


GRANT SELECT ON demodb.demotable TO 'demouser'@'127.0.0.1';



  Query OK, 0 rows affected (0.00 sec)


FLUSH PRIVILEGES;



  Query OK, 0 rows affected (0.01 sec)


Then you can log in this way:

mysql -u demouser -p -h 127.0.0.1 demodb


Credits to http://www.rathishkumar.in/2017/04/error-1045-28000-access-denied-for-user-user-host-using-password-YES.html