mysql.global_priv Table
The mysql.global_priv
table was introduced in MariaDB 10.4.1 to replace the mysql.user table.
The mysql.global_priv
table contains information about users that have permission to access the MariaDB server, and their global privileges.
Note that the MariaDB privileges occur at many levels. A user may not be granted create
privilege at the user level, but may still have create
permission on certain tables or databases, for example. See privileges for a more complete view of the MariaDB privilege system.
The mysql.global_priv
table contains the following fields:
Field | Type | Null | Key | Default | Description |
---|---|---|---|---|---|
Host |
char(60) |
NO | PRI | Host (together with User makes up the unique identifier for this account). |
|
User |
char(80) |
NO | PRI | User (together with Host makes up the unique identifier for this account). |
|
Priv |
longtext |
NO | Global privileges, granted to the account and other account properties |
From MariaDB 10.5.2, in order to help the server understand which version a privilege record was written by, the priv
field contains a new JSON field, version_id
(MDEV-21704).
Examples
select * from mysql.global_priv; +-----------+-------------+---------------------------------------------------------------------------------------------------------------------------------------+ | Host | User | Priv | +-----------+-------------+---------------------------------------------------------------------------------------------------------------------------------------+ | localhost | root | {"access": 18446744073709551615,"plugin":"mysql_native_password","authentication_string":"*6C387FC3893DBA1E3BA155E74754DA6682D04747"} | | 127.% | msandbox | {"access":1073740799,"plugin":"mysql_native_password","authentication_string":"*6C387FC3893DBA1E3BA155E74754DA6682D04747"} | | localhost | msandbox | {"access":1073740799,"plugin":"mysql_native_password","authentication_string":"*6C387FC3893DBA1E3BA155E74754DA6682D04747"} | | localhost | msandbox_rw | {"access":487487,"plugin":"mysql_native_password","authentication_string":"*6C387FC3893DBA1E3BA155E74754DA6682D04747"} | | 127.% | msandbox_rw | {"access":487487,"plugin":"mysql_native_password","authentication_string":"*6C387FC3893DBA1E3BA155E74754DA6682D04747"} | | 127.% | msandbox_ro | {"access":262145,"plugin":"mysql_native_password","authentication_string":"*6C387FC3893DBA1E3BA155E74754DA6682D04747"} | | localhost | msandbox_ro | {"access":262145,"plugin":"mysql_native_password","authentication_string":"*6C387FC3893DBA1E3BA155E74754DA6682D04747"} | | 127.% | rsandbox | {"access":524288,"plugin":"mysql_native_password","authentication_string":"*B07EB15A2E7BD9620DAE47B194D5B9DBA14377AD"} | +-----------+-------------+---------------------------------------------------------------------------------------------------------------------------------------+
Readable format:
SELECT CONCAT(user, '@', host, ' => ', JSON_DETAILED(priv)) FROM mysql.global_priv; +--------------------------------------------------------------------------------------+ | CONCAT(user, '@', host, ' => ', JSON_DETAILED(priv)) | +--------------------------------------------------------------------------------------+ | root@localhost => { "access": 18446744073709551615, "plugin": "mysql_native_password", "authentication_string": "*6C387FC3893DBA1E3BA155E74754DA6682D04747" } | | msandbox@127.% => { "access": 1073740799, "plugin": "mysql_native_password", "authentication_string": "*6C387FC3893DBA1E3BA155E74754DA6682D04747" } | +--------------------------------------------------------------------------------------+
A particular user:
SELECT CONCAT(user, '@', host, ' => ', JSON_DETAILED(priv)) FROM mysql.global_priv WHERE user='marijn'; +--------------------------------------------------------------------------------------+ | CONCAT(user, '@', host, ' => ', JSON_DETAILED(priv)) | +--------------------------------------------------------------------------------------+ | marijn@localhost => { "access": 0, "plugin": "mysql_native_password", "authentication_string": "", "account_locked": true, "password_last_changed": 1558017158 } | +--------------------------------------------------------------------------------------+
From MariaDB 10.5.2:
GRANT FILE ON *.* TO user1@localhost; SELECT Host, User, JSON_DETAILED(Priv) FROM mysql.global_priv WHERE user='user1'\G *************************** 1. row *************************** Host: localhost User: user1 JSON_DETAILED(Priv): { "access": 512, "plugin": "mysql_native_password", "authentication_string": "", "password_last_changed": 1581070979, "version_id": 100502 }
© 2021 MariaDB
Licensed under the Creative Commons Attribution 3.0 Unported License and the GNU Free Documentation License.
https://mariadb.com/kb/en/mysqlglobal_priv-table/