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 |
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 } | +--------------------------------------------------------------------------------------+
© 2019 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/