Databases 3 min read

How to Simplify Permission Management with MariaDB Roles

This article explains why database roles are essential for efficient permission handling, outlines the benefits of using roles, and provides step‑by‑step instructions with screenshots for creating and assigning roles in MariaDB, while noting MySQL's current lack of support.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
How to Simplify Permission Management with MariaDB Roles

Grant Role?

Creating roles has been supported by Oracle for a long time, but MySQL 5.7 still does not support it. Only MariaDB 10.0/10.1 and later provide role creation.

Why We Need Roles

In practice many users share the same permissions, e.g., read‑only. Granting each user individually is cumbersome.

Roles let DBA define permission groups once and assign them to users, avoiding per‑user management.

When role permissions change, administrators do not need to modify each user’s privileges.

Roles Overview

Using Roles in MariaDB

Create a role named dbuser.

Grant SELECT, INSERT, UPDATE, DELETE privileges to the dbuser role.

Assign the role to user helei@'%' and set password MANAGER (see image).

Set dbuser as the default role for helei and enable the role.

Because only the helei user has the dbuser role and the role does not have CREATE privilege, attempts to create tables result in a “create command denied” error.

Conclusion

Role creation greatly reduces the complexity of maintaining user permissions, and we look forward to MySQL adding this feature.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

SQLpermission managementMariaDBDatabase RolesUser Administration
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.