mariadb-create-user

Documents MariaDB-specific CREATE USER syntax, authentication chaining, and account options.

28|115|Updated Jan 28, 2025
One-click install
npx skills add https://github.com/mariadb-corporation/mariadb-docs --skill mariadb-create-user-mariadb-corporation
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: mariadb-create-user
Source: https://github.com/mariadb-corporation/mariadb-docs/tree/main/agent-skills/granular/statements/mariadb-create-user
Command: npx skills add https://github.com/mariadb-corporation/mariadb-docs --skill mariadb-create-user-mariadb-corporation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Generic SQL knowledge often leads to incorrect MariaDB CREATE USER statements, such as assuming SHA-2 default plugins, misusing IDENTIFIED BY PASSWORD with plain text, or relying on GRANT to implicitly create users. This Skill provides the exact MariaDB-specific syntax and behavior so generated statements work correctly the first time. ## Core Features & Use Cases - Authentication Chaining: Chain multiple authentication plugins with OR (e.g., ed25519 OR unix_socket OR pam) on a single account, with correct USING/AS and PASSWORD() semantics per plugin. - TLS, Resource, Expiry, and Lock Options: Correct usage of REQUIRE SSL/X509/CIPHER/ISSUER/SUBJECT, WITH resource limits, PASSWORD EXPIRE variants, and ACCOUNT LOCK/UNLOCK. - Use Case: When asked to create an application database user that authenticates via ed25519 with a unix_socket fallback, requires TLS, and limits connections per hour, this Skill ensures the generated statement uses valid MariaDB grammar and avoids traps like defaulting the host to '%' unintentionally. ## Quick Start Write a MariaDB CREATE USER statement for an app account that uses ed25519 authentication with a unix_socket fallback, requires SSL, and limits the user to 100 connections per hour.

Frequently Asked Questions about mariadb-create-user

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a user in MariaDB with multiple authentication methods?▼

Chain authentication plugins on one account using OR in the IDENTIFIED VIA clause, for example: CREATE USER safe@'%' IDENTIFIED VIA ed25519 USING PASSWORD('secret') OR unix_socket. Mechanisms are tried in the order written, and the first success wins.

What is the difference between IDENTIFIED BY and IDENTIFIED BY PASSWORD in MariaDB?▼

IDENTIFIED BY 'password' accepts plain text, which the server hashes via PASSWORD() before storage. IDENTIFIED BY PASSWORD 'hash' expects an already-hashed PASSWORD() output value, not plain text. Both forms work only with mysql_native_password and mysql_old_password plugins.

Does GRANT create a user automatically in MariaDB?▼

No. MariaDB sets NO_AUTO_CREATE_USER in sql_mode by default, so GRANT to a non-existent user returns an error instead of creating the account. Always issue an explicit CREATE USER statement before granting privileges.

Why does CREATE USER fail with ERROR 1396 in MariaDB?▼

ERROR 1396 (HY000) occurs when the account already exists and neither OR REPLACE nor IF NOT EXISTS was specified. Use CREATE USER IF NOT EXISTS to downgrade it to a warning, or CREATE OR REPLACE USER to drop and recreate the account unconditionally.

What host does MariaDB use when CREATE USER omits the host part?▼

Omitting the host defaults the account to 'user'@'%', which matches connections from any host, not localhost. To restrict the account to local connections, write 'user'@'localhost' explicitly.

Can REQUIRE SSL be combined with other TLS options in MariaDB?▼

No. REQUIRE SSL and REQUIRE X509 cannot be combined with other TLS options because each already implies the weaker one. Only CIPHER, ISSUER, and SUBJECT can be combined with each other using AND.