AWS Access denied for user ‘user1’@’ipaddress’ (using password: YES)

ERROR 1044 (42000): Access denied for user ‘user1’@’localhost’ to database ‘db’

We created a user and give permission as follows in AWS RDS MariaDB database:

-- Create a user user1
Create user user1@'%' identified by 'abc123';

--Grant select to the user USER1 for all databases
Grant select on *.* to 'user1'@'%';

--when try to connect, we are getting the following error:
ERROR 1044 (42000): Access denied for user 'user1'@'localhost' to database 'db'

Solution:

Workaround for the issue is to use ‘%’.* instead of *.* in the command in AWS RDS MariaDB Environment:

GRANT SELECT ON '%'.* TO 'user1'@'%';

Hopefully this will fix the issue of connectivity with AWS RDS database