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
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
* [https://mariadb.com/kb/en/grant/ MariaDB Knowledge Base]
* [https://mariadb.com/kb/en/grant/ MariaDB Knowledge Base]
==Example==
==Example==
* <syntaxhighlight inline lang=SQL>GRANT ALL ON roundcube.* to 'rc-bot'@localhost;</syntaxhighlight>
* <syntaxhighlight inline lang=SQL>GRANT ALL ON `roundcube`.* to 'rc-bot'@localhost;</syntaxhighlight>
* <syntaxhighlight inline lang=SQL>GRANT ALL PRIVILEGES ON `woozdev-mw`.* TO 'wooz-dev-mw'@'localhost' IDENTIFIED BY '</syntaxhighlight>{{arg|password}}<code>'</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}} ]

Latest revision as of 01:59, 26 April 2026

Reference

Example

  • GRANT ALL ON `roundcube`.* to 'rc-bot'@localhost;
  • GRANT ALL PRIVILEGES ON `woozdev-mw`.* TO 'wooz-dev-mw'@'localhost' IDENTIFIED BY '<password>';

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]
    • <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...]
    • <user option>: one of –
      • REQUIRE {NONE | <TLS option> [[AND] repeat...]
      • [WITH <with option> [repeat...]
    • <with option>: one of –
      • GRANT OPTION
      • <resource_option>
  • GRANT <rolename> TO <grantee> [, repeat...] [WITH ADMIN OPTION]
    • <grantee>: one of –
      • <rolename>
      • <username> [ <authentication option> ]