W3cubDocs

/MariaDB

mysql.db Table

The mysql.db table contains information about database-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 not be granted a privilege at the database level, but may still have permission on a table level, for example. See privileges for a more complete view of the MariaDB privilege system.

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.db table contains the following fields:

Field Type Null Key Default Description Introduced
Host char(60) NO PRI Host (together with User and Db makes up the unique identifier for this record. Until MariaDB 5.5, if the host field was blank, the corresponding record in the mysql.host table would be examined. From MariaDB 10.0, a blank host field is the same as the % wildcard.
Db char(64) NO PRI Database (together with User and Host makes up the unique identifier for this record.
User char(80) NO PRI User (together with Host and Db makes up the unique identifier for this record.
Select_priv enum('N','Y') NO N Can perform SELECT statements.
Insert_priv enum('N','Y') NO N Can perform INSERT statements.
Update_priv enum('N','Y') NO N Can perform UPDATE statements.
Delete_priv enum('N','Y') NO N Can perform DELETE statements.
Create_priv enum('N','Y') NO N Can CREATE TABLE's.
Drop_priv enum('N','Y') NO N Can DROP DATABASE's or DROP TABLE's.
Grant_priv enum('N','Y') NO N User can grant privileges they possess.
References_priv enum('N','Y') NO N Unused
Index_priv enum('N','Y') NO N Can create an index on a table using the CREATE INDEX statement. Without the INDEX privilege, user can still create indexes when creating a table using the CREATE TABLE statement if the user has have the CREATE privilege, and user can create indexes using the ALTER TABLE statement if they have the ALTER privilege.
Alter_priv enum('N','Y') NO N Can perform ALTER TABLE statements.
Create_tmp_table_priv enum('N','Y') NO N Can create temporary tables with the CREATE TEMPORARY TABLE statement.
Lock_tables_priv enum('N','Y') NO N Acquire explicit locks using the LOCK TABLES statement; user also needs to have the SELECT privilege on a table in order to lock it.
Create_view_priv enum('N','Y') NO N Can create a view using the CREATE_VIEW statement.
Show_view_priv enum('N','Y') NO N Can show the CREATE VIEW statement to create a view using the SHOW CREATE VIEW statement.
Create_routine_priv enum('N','Y') NO N Can create stored programs using the CREATE PROCEDURE and CREATE FUNCTION statements.
Alter_routine_priv enum('N','Y') NO N Can change the characteristics of a stored function using the ALTER FUNCTION statement.
Execute_priv enum('N','Y') NO N Can execute stored procedure or functions.
Event_priv enum('N','Y') NO N Create, drop and alter events.
Trigger_priv enum('N','Y') NO N Can execute triggers associated with tables the user updates, execute the CREATE TRIGGER and DROP TRIGGER statements.
Delete_history_priv enum('N','Y') NO N Can delete rows created through system versioning. MariaDB 10.3.5

The Acl_database_grants status variable, added in MariaDB 10.1.4, indicates how many rows the mysql.db 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.

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