Search code examples
mysqlamazon-aurorasql-grant

The GRANT command does not work properly in MySQL


I am using AWS AuroraDB.

I tried to give SELECT permission to the user by entering like this.

USER mysql;
GRANT SELECT ON 'sample'.'sample_table' TO 'user'@'111.11.%.%';
FLUSH PRIVILEGES;

When I tried this command, 'sample'.'sample_table' was not shown. But other permissions are visible.

SHOW GRANTS FOR 'user'@'111.11.%.%'

please help me. thank you:)


Solution

  • You are missing TO after object name. Other than that, the first command should be USE db_name. The correct syntax should be like this:

    USE db_name;
    GRANT SELECT ON 'sample'.'sample_table' TO 'user'@'111.11.%.%';
    FLUSH PRIVILEGES;
    

    More information look at their documentation.