Database User Accounts for MariaDB Xpand

Overview

With MariaDB Xpand, you can create, alter, and drop database user accounts.

Create

To create a database user account with MariaDB Xpand, use the CREATE USER statement:

CREATE USER 'USER'@'192.0.2.%'
   IDENTIFIED BY 'PASSWD';

Replace the referenced IP address with the relevant address for your environment.

Replace USER and PASSWD with appropriate credentials for the new user account.

Alter

To alter a database user account with MariaDB Xpand, use the ALTER USER statement:

CREATE USER 'USER'@'192.0.2.%'
   IDENTIFIED BY 'PASSWD';

Drop

To drop a database user account with MariaDB Xpand, use the DROP USER statement:

DROP USER 'USER'@'192.0.2.%';

System Tables

The following system tables are related to user accounts, roles, and privileges:

System Table

Description

roles

Stores the names of all roles on the Xpand cluster.

roles_mapping

Stores the mapping between roles and and user specifications, including whether the user was granted WITH ADMIN for the role.

session_roles

Stores the list of roles available to a session.

users

Stores user account details

user_acl

Stores global, database, and table privileges for user accounts

user_role_links

Stores a mapping between roles and user specifications, including whether the role is a default role for the user.

user_routine_acl

Stores routine privileges for user accounts

Caveats

  • Xpand does not support:

    • DROP USER IF EXISTS

    • netmask notation for IP addresses

    • directly modifying the users table.

  • Xpand allows usernames and hostnames to be up to 256 characters long and will truncate names longer than the permitted length. Xpand recommends that usernames be 16 characters or shorter and hostnames be 60 characters or shorter.