Search code examples
mysqlsqldatatablesql-grant

mysql grant select privilege on only one table and some columns of it


I have a table with around 10 columns I have created a user with no privileges select.

Now I want it to grant only select privileges to only that table and if possible only 2-3 columns.


Solution

  • https://dev.mysql.com/doc/refman/5.1/en/grant.html#grant-column-privileges

    GRANT SELECT (col1,col2) ON database.table TO 'someuser'@'localhost' IDENTIFIED BY 'password';