MariaDB/SQL/GRANT: Difference between revisions

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Created page with "==Syntax== * <code>GRANT</code> {{fmt/arg|priv list}} <code>ON</code> {{fmt/arg|object type}} {{fmt/arg|priv level}} <code>TO</code> {{fmt/arg|user spec}} [ {{fmt/arg|user opt..."
 
No edit summary
Line 1: Line 1:
==Related==
* <code>{{l/same|REVOKE}}</code> negates privileges granted by <code>GRANT</code>.
* <code>{{l/same|SHOW GRANTS}}</code> lists privileges granted by <code>GRANT</code>. (see <code>{{l/same|SHOW}}</code>)
==Syntax==
==Syntax==
* <code>GRANT</code> {{fmt/arg|priv list}} <code>ON</code> {{fmt/arg|object type}} {{fmt/arg|priv level}} <code>TO</code> {{fmt/arg|user spec}} [ {{fmt/arg|user options}} ]
* <code>GRANT</code> {{fmt/arg|priv list}} <code>ON</code> {{fmt/arg|object type}} {{fmt/arg|priv level}} <code>TO</code> {{fmt/arg|user spec}} [ {{fmt/arg|user options}} ]
** '''{{fmt/arg|priv list}}''': {{fmt/arg|priv_type}} {{fmt/arg/opt|column_list}} [, ''repeat...'']
** '''{{fmt/arg|priv list}}''': {{fmt/arg|priv_type}} {{fmt/arg/opt|column_list}} [, ''repeat...'']
** '''{{fmt/arg|priv_type}}''': ''one of &ndash;''
*** <code>USAGE</code>
*** <code>ALL</code> [<code>PRIVILEGES</code>]
*** <code>GRANT OPTION</code>
** '''{{fmt/arg|object type}}''': ''one of &ndash;''
** '''{{fmt/arg|object type}}''': ''one of &ndash;''
*** <code>TABLE</code>
*** <code>TABLE</code>

Revision as of 18:02, 16 February 2025

Syntax

  • GRANT <priv list> ON <object type> <priv level> TO <user spec> [ <user options> ]
    • <priv list>: <priv_type> [ <column_list> ] [, repeat...]
    • <priv_type>: one of –
      • USAGE
      • ALL [PRIVILEGES]
      • GRANT OPTION
    • <object type>: one of –
      • TABLE
      • FUNCTION
      • PROCEDURE
      • PACKAGE
      • PACKAGE BODY
    • <priv level>: one of –
      • *
      • *.*
      • <db_name>.*
      • <db_name>.<tbl_name>
      • <tbl_name>
      • <db_name>.<routine_name>
    • <user spec>: one of –
      • <username> [ <authentication option> ]
      • PUBLIC
    • [ <authentication option> ]: one of –
      • IDENTIFIED BY '<password>'
      • IDENTIFIED BY PASSWORD 'password_hash'
      • IDENTIFIED {VIA|WITH} <authentication rule> [OR repeat...]
  • GRANT <rolename> TO <grantee> [, repeat...] [WITH ADMIN OPTION]
    • <grantee>: one of –
      • <rolename>
      • <username> [ <authentication option> ]