ENABLE ENCRYPTION in MariaDB secures data in-flight (TLS) and at-rest (tablespace/table encryption) by toggling server variables and ALTER TABLE options.
MariaDB supports two separate features: TLS to encrypt client-server traffic and InnoDB/XtraDB encryption to protect data files on disk. Both are configured by the DBA, not ordinary DML.
Load a certificate pair, then add to my.cnf: [mysqld]ssl_cert=/etc/ssl/mariadb.crtssl_key=/etc/ssl/mariadb.keyssl_ca=/etc/ssl/ca.crtrequire_secure_transport=ON
Supply arguments: mariadb --ssl-ca=ca.crt --ssl-cert=client.crt --ssl-key=client.key
.Frameworks such as JDBC add useSSL=true
.
In mysqld
section add: plugin_load_add=file_key_management.so
and restart. Provide file_key_management_filename
and file_key_management_encryption_algorithm=AES_CTR
.
Set: innodb_encrypt_tables=ON
, innodb_encrypt_log=ON
, innodb_encryption_threads=4
. All subsequently created tablespaces will use encryption.
Run ALTER TABLE Orders ENCRYPTION='Y', ENCRYPTION_KEY_ID=1;
. MariaDB rebuilds the table and writes the data with the key from the keyring plugin.
Yes. Supply ENCRYPTION_KEY_ID
for each table.Maintain keys via the file key-management file or an external KMS.
Query information_schema.INNODB_TABLESPACES_ENCRYPTION
. A non-NULL KEY_ID
and ENCRYPTION_SCHEME=1
indicate success.
ALTER TABLE ... ENCRYPTION_KEY_ID
.Missing keyring plugin: Encryption variables silently ignored. Load the plugin before enabling variables.
SSL certificate mismatch: Connection fails with ERROR 2026
.Ensure CA file matches the server certificate chain.
1. Install keyring plugin
2. Define keys
3. Set innodb_encrypt_tables=ON
4. Restart server
5. ALTER existing tables
6. Verify via INFORMATION_SCHEMA.
.
Yes. Key management plugins and InnoDB encryption are included from 10.1 onward.
CPU overhead is small (≈3-7 %) on modern processors with AES-NI. Measure in staging before production rollout.
Run ALTER TABLE ... ENCRYPTION='N'
to rebuild the table unencrypted, then set global variables back to OFF.