Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2012
    Posts
    19

    Unanswered: What is the right syntax to Grant 1 user 2 priv on 2 tables?

    How do I use the GRANT command to give a user SELECT and INSERT privileges on 2 different tables in the same database?

    I used this:
    Code:
    GRANT select, insert
    ON table1, table2
    TO user;
    I get;
    Code:
    ERROR 1064 (42000)...  ...  for the right syntax to use near 'table2 TO user'
    Thanks for your help

  2. #2
    Join Date
    Sep 2009
    Location
    San Sebastian, Spain
    Posts
    880
    You can only grant on one object at a time. So you need to issue 2 statements:

    Code:
    GRANT SELECT, INSERT ON table1 TO user;
    GRANT SELECT, INSERT ON table2 TO user;
    Ronan Cashell
    Certified Oracle DBA/Certified MySQL Expert (DBA & Cluster DBA)
    http://www.it-iss.com
    Follow me on Twitter

  3. #3
    Join Date
    Mar 2012
    Posts
    19
    Thanks very much

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •