RDS Mariadb Grant All permission access denied for user

This is a peculiar error with Mariadb on RDS, this problem does not happen if you select the MySQL or Aurora Engine. If you try to run a GRANT ALL ON query you get an error like

ERROR 1044 (42000): Access denied for user

The error occurs even if the query is run as root or the admin user. Alternative is to give selective permission/privileges to the user.
You can instead run the query as

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER  on `dbname`.* to 'dbuser'@'%' IDENTIFIED BY 'P45sw0rd';

and its done!

A bit of explanation

In RDS, the superuser is named rdsadmin, this user is equivalent to the root user in a normal non-RDS MySQL/Mariadb Server. The Master user which we have access to in RDS do not have all the privileges as required for root user to create a new user. This user cannot GRANT ALL PRIVILEGES to a normal user for database access. So we have to give user selective privileges only.

How useful was this post?

Click on a star to rate it!

Average rating 4.9 / 5. Vote count: 18

No votes so far! Be the first to rate this post.

Leave a comment

Your email address will not be published. Required fields are marked *