puk
puk

Reputation: 16762

Can't grant column specific privileges in MySQL

Going off of this answer I am executing the below statements

CREATE TABLE person
(
   id      INT NOT NULL AUTO_INCREMENT,
   PRIMARY KEY (id)
);
GRANT SELECT ON person(id) TO SomeOne;

but when I do so, I get the following error:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(id) TO SomeOne' at line 1

Can someone shed some light as to why I am getting this error.

MysQL version:

mysql Ver 14.14 Distrib 5.1.58, for debian-linux-gnu (i686) using readline 6.2

Upvotes: 0

Views: 961

Answers (2)

Sudhir Bastakoti
Sudhir Bastakoti

Reputation: 100175

Try:


GRANT select (`id`) ON your_db_name.your_table_name TO SomeOne

Upvotes: 3

vyegorov
vyegorov

Reputation: 22855

GRANT SELECT (id) ON person TO SomeOne;

Check the documentation here for more details.

Upvotes: 2

Related Questions