Enable Encryption secures MySQL data in transit (TLS) and at rest (InnoDB tablespace encryption) by activating SSL parameters, rotating keys, and enforcing encrypted connections.
Encryption protects sensitive customer, order, and payment data from network sniffing and disk theft. TLS secures traffic between clients and the server, while InnoDB tablespace encryption secures data files on disk.
1) Generate server CA, certificate, and key.
2) Add ssl_ca
, ssl_cert
, and ssl_key
paths in my.cnf
.
3) Set require_secure_transport = ON
and restart MySQL.
4) Re-create or alter users with REQUIRE SSL
.
Run SHOW VARIABLES LIKE 'have_ssl';
then connect with mysql --ssl-mode=REQUIRED
to verify encryption.
1) Enable file-per-table: innodb_file_per_table = ON
.
2) Turn on tablespace encryption: innodb_encrypt_tables = ON
and innodb_encrypt_log = ON
.
3) Restart MySQL, then issue ALTER INSTANCE ROTATE INNODB MASTER KEY;
.
ALTER TABLE Orders ENCRYPTION='Y';
encrypts historical order data without changing application code.
Rotate keys after employee turnover, certificate expiry, or policy changes. Use ALTER INSTANCE ROTATE INNODB MASTER KEY;
during a low-traffic window and back up keys immediately.
• Store certificates and master keys on encrypted volumes.
• Monitor ERROR
log for SSL or key-ring errors.
• Automate certificate renewal with cron and SET PERSIST require_secure_transport = ON;
.
Yes. Define users like CREATE USER 'checkout'@'%' IDENTIFIED BY '•••' REQUIRE SSL;
. Add --ssl-mode=REQUIRED
in application connection strings.
TLS adds ~1–3 ms handshake overhead. InnoDB encryption costs ~3–5% CPU. Modern CPUs with AES-NI minimize impact.
Yes. TLS can be enabled by restarting one replica at a time behind a load balancer. Table encryption can be applied table-by-table online in MySQL 8.0.
No. MySQL Community Edition supports TLS and InnoDB tablespace encryption starting in 5.7, but requires the keyring_file plugin.