How to Configure MariaDB Encryption at REST

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up mariadb encryption at rest by turning on a key plugin and enabling table encryption. The database then scrambles tablespaces, redo logs, and binary logs before writing them to disk. Most teams pair this disk protection with standard database roles for daily work. Still, wide user permissions still let logged-in staff read every clear row during an active session. How mariadb encryption at rest works in practice Database encryption at rest protects physical files stored on your serv

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You set up mariadb encryption at rest by turning on a key plugin and enabling table encryption. The database then scrambles tablespaces, redo logs, and binary logs before writing them to disk. Most teams pair this disk protection with standard database roles for daily work. Still, wide user permissions still let logged-in staff read every clear row during an active session.

How mariadb encryption at rest works in practice

Database encryption at rest protects physical files stored on your server drives. First, your team chooses a key management plugin supported by the database engine. Some teams use a local file key plugin for simple test setups. Other teams integrate an external key service or cloud key manager for production servers. The key plugin holds a master key that locks and unlocks lower-level table keys.

Next, the admin updates the main server settings to load the chosen plugin at startup. You can tell the engine to encrypt all new tables by default. You can also turn on encryption for redo logs and binary replication logs. Temporary files and internal system tablespaces also need encryption settings turned on. Once active, the engine encrypts data blocks right before writing them to the disk. When a query asks for data, the engine reads the block and decrypts it in memory.

Managing keys and rotating secrets safely

Strong disk protection depends on how you store and rotate your encryption keys. If the master key sits on the same disk as the data, an attacker can take both. Teams should store master keys in a separate key management service with strict role permissions. Only the database service account should have permission to fetch those keys at startup.

Key rotation is another vital part of keeping stored database files safe over time. When you rotate a master key, the database re-encrypts the internal table keys with the new version. Background threads can also re-encrypt data pages when you change key versions. Admins must test backup and restore steps to make sure keys stay available during a disaster. Without the matching key version, a physical backup file cannot be read or restored.

Encryption at Rest + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What disk encryption solves and what it leaves open

Disk encryption stops threats that target underlying storage media. If someone steals a hard drive or copies a raw volume snapshot, they only get scrambled bytes. It also helps teams meet strict audit rules for stored customer data. Backup archives written to external object storage stay locked unless the reader holds the right key.

Still, encryption at rest does nothing once the database engine loads pages into memory. To a user with valid login credentials, the database returns plain text on every query. If an engineer logs in with a broad role, they receive raw emails, phone numbers, and card numbers. Native disk encryption decides how bytes sit on a drive, not what live queries return. Teams still need a way to inspect active statements and rewrite sensitive fields in query results.

Check MySQL queries and results on the wire

MySQL grants control who logs in. They do not check single queries or mask sensitive columns once a session starts. With hoop.dev, you run an open-source proxy, a sidecar for your MySQL, inline in the MySQL wire protocol. On every query an AI agent or human runs against production MySQL, RDS, or Aurora, hoop.dev decides to pass, mask, block, or hold it for review.

Multi-statement batches and prepared queries are split and checked one by one by hoop.dev guardrails, which refuse banned queries with a native MySQL error or hold risky ones for approval. On the response path, hoop.dev data masking rewrites string values in returned rows in memory, and every decision is logged. See the MIT-licensed project on GitHub.

Frequently asked questions

Does mariadb encryption at rest slow down read and write queries?

Encrypting and decrypting pages adds a small amount of CPU work on the server. Modern processors have built-in hardware instructions that handle encryption math very fast. Most teams notice very little change in query speed during normal daily traffic.

Are database backups encrypted when disk encryption is on?

Physical backups copy the raw encrypted files directly from the disk and stay encrypted. Logical backups run normal read queries against the live server and export plain text. You must encrypt logical dump files yourself before moving them to external storage.

Does disk encryption hide sensitive columns from database administrators?

No, disk encryption only locks the raw files stored on the server drive. Any user who logs into the database with read permissions gets plain text results. To hide emails or national IDs during live sessions, you need dynamic data masking.

The query runs. The emails stay hidden.