mariadb-drop-user

Guides writing and reviewing MariaDB DROP USER and RENAME USER statements.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Dropping or renaming MariaDB accounts has non-obvious behaviors that cause production surprises: dropped users keep working on active connections, owned objects and granted privileges are never cascaded, and views or routines are left with dangling DEFINER references. This Skill encodes those MariaDB-specific semantics so generated or reviewed account-teardown SQL is correct. ## Core Features & Use Cases - DROP USER semantics: Covers multi-account comma-separated drops, IF EXISTS turning missing-user errors into notes, the active-connections warning, and the required CREATE USER or mysql-database DELETE privilege. - No-cascade awareness: Explains that owned objects stay ownerless, privileges granted by the dropped user to others survive, and DEFINER objects must be re-pointed before the drop. - RENAME USER behavior: Documents privilege preservation across renames, host-part changes, partial-success error semantics, and the absence of any active-session check. - Use Case: When writing an idempotent cleanup script that decommissions service accounts, generate DROP USER IF EXISTS 'svc_batch'@'%', 'svc_report'@'%'; plus KILL CONNECTION statements for live sessions instead of one failing statement per account. ## Quick Start Ask the AI to write or review a MariaDB DROP USER or RENAME USER statement for your account cleanup scenario.

Frequently Asked Questions about mariadb-drop-user

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

FAQPage Schema
How do I drop multiple MariaDB users in one statement?▼

DROP USER accepts a comma-separated list of accounts in a single statement, such as DROP USER 'u1'@'%', 'u2'@'%';. This produces one binlog event and one round trip instead of looping over individual statements.

Does DROP USER in MariaDB kill active connections?▼

No, DROP USER does not terminate active sessions. A dropped account keeps working with its privileges until it disconnects, while MariaDB blocks new connections and emits a note-level warning. Use KILL CONNECTION for each live session to cut access immediately.

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

ERROR 1396 occurs when the account does not exist and IF EXISTS was not specified. Adding IF EXISTS converts the missing-account error into a note, which keeps idempotent teardown scripts from failing.

What happens to views and procedures after dropping their DEFINER user?▼

The objects remain with a now-nonexistent definer, and invoking them fails with a definer-does-not-exist error. Re-point the DEFINER with ALTER VIEW or equivalent statements before dropping the account.

Does RENAME USER in MariaDB preserve privileges?▼

Yes, RENAME USER preserves all existing privileges because they attach to the underlying account record, which follows the new name automatically. No re-GRANT is needed, and the server performs no active-session check during the rename.