mariadb-core-security-model
Installation
SKILL.md
MariaDB Core Security Model
How MariaDB authenticates users, stores privileges, activates roles, encrypts data at rest, and protects connections with TLS. Read this skill before creating any user, before enabling encryption, and before assuming MySQL security commands map one-to-one onto MariaDB.
Quick Reference
- ed25519 is the modern default authentication plug-in. mysql_native_password (SHA-1) is legacy ; use it only for clients that cannot speak ed25519.
- Privileges live in
mysql.global_privsince 10.4+.mysql.useris now a backward-compatibility view overglobal_priv, NOT the authoritative table. - Encryption at rest needs ALL of :
innodb_encrypt_tables,innodb_encrypt_log,encrypt_binlog,encrypt_tmp_files,aria_encrypt_tables. Encrypting only tables leaks data through the binlog and temp files. - Roles exist since 10.0.5. ALWAYS pair
GRANT <role> TO <user>withSET DEFAULT ROLE <role> FOR <user>so the user gets the role on connect. - TLS requires BOTH
REQUIRE SSL(or stricter) on theGRANTANDssl_cert/ssl_key/ssl_caserver variables. One without the other fails open or fails closed. - ALWAYS run
mariadb-upgradeexactly once after a major version upgrade to migratemysql.userrows intomysql.global_priv. NEVER run it twice in a row. - NEVER
GRANT ALL ON *.* TO 'app_user'@'%'.ALLincludesSUPER,FILE,PROCESS,RELOAD,SHUTDOWN. An SQL-injection in any code path escalates to server-level. - File-key-management gained
file_key_management_use_pbkdf2andfile_key_management_digestin 12.0.1+ for key-derivation hardening. - ed25519 password hashing requires the
ed25519_password()UDF orUSING PASSWORD('secret')shortcut. The legacyPASSWORD()function does NOT work with ed25519.
Authentication Plug-ins
MariaDB authentication is plug-in based. The server consults the plugin column of mysql.global_priv (the JSON Priv.plugin field, since 10.4+) to pick a verification routine per user.