mysql.tables_priv Table

The mysql.tables_priv table contains information about table-level privileges. The table can be queried and although it is possible to directly update it, it is best to use GRANT for setting privileges.

Note that the MariaDB privileges occur at many levels. A user may be granted a privilege at the table level, but may still not have permission on a database level, for example. See privileges for a more complete view of the MariaDB privilege system.

The INFORMATION_SCHEMA.TABLE_PRIVILEGES table derives its contents from mysql.tables_priv.

MariaDB starting with 10.4

In MariaDB 10.4 and later, this table uses the Aria storage engine.

MariaDB until 10.3

In MariaDB 10.3 and before, this table uses the MyISAM storage engine.

The mysql.tables_priv table contains the following fields:

Field Type Null Key Default Description
Host char(60) NO PRI Host (together with User, Db and Table_namemakes up the unique identifier for this record.
Db char(64) NO PRI Database (together with User, Host and Table_namemakes up the unique identifier for this record.
User char(80) NO PRI User (together with Host, Db and Table_namemakes up the unique identifier for this record.
Table_name char(64) NO PRI Table name (together with User, Db and Tablemakes up the unique identifier for this record.
Grantor char(141) NO MUL
Timestamp timestamp NO CURRENT_TIMESTAMP
Table_priv set('Select', 'Insert', 'Update', 'Delete', 'Create', 'Drop', 'Grant', 'References', 'Index', 'Alter', 'Create View', 'Show view', 'Trigger', 'Delete versioning rows') NO The table privilege type. See Table Privileges for details.
Column_priv set('Select', 'Insert', 'Update', 'References') NO The column privilege type. See Column Privileges for details.

The Acl_table_grants status variable, added in MariaDB 10.1.4, indicates how many rows the mysql.tables_priv table contains.

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.

© 2021 MariaDB
Licensed under the Creative Commons Attribution 3.0 Unported License and the GNU Free Documentation License.
https://mariadb.com/kb/en/mysqltables_priv-table/