MariaDB permissions and privileges
MariaDB in Pukki is still in beta
This means that it hasn't been tested as extensively as PostgreSQL, and there might still be large changes to how Pukki manages MariaDB database instances. We hope to move out of beta in March 2025.
About privileges
When creating a user through the web interface or via openstack cli, you can define which databases it has access to. By default, a freshly created user doesn't have access to any databases.
When creating a new user:
When updating an existing user:
You can either specify a single database or a list of databases to these commands. The commands also accept the database instance's name in place of the ID.Giving a user access to a database via openstack cli or the web interface means it gets
ALL PRIVILEGES
to that database.
If you want more control over a user's privileges, you have to enable root access (through
the web interface, or with openstack database enable root
with the CLI client) and manually
modify user privileges.
Example of giving a user read-only access to a database
-
Enable the root user:
-
Access the database using the root user and password.
-
Grant
SELECT
privileges on a database to a user:
You can view the grant with:
SHOW GRANTS FOR 'reader'@'%';
+-------------------------------------------------------------------------------------------------------+
| Grants for reader@% |
+-------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO `reader`@`%` IDENTIFIED BY PASSWORD 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' |
| GRANT SELECT ON `database_name`.* TO `reader`@`%` |
+-------------------------------------------------------------------------------------------------------+
You can also grant table-specific access:
Be aware that the openstack cli tool or the the web interface will not display grants given through root access. For more information on MariaDB's grants, refer to the official MariaDB documentation.