Cybrove
Database Security

Is MySQL Secure? Security Features, Risks, and Hardening

Yes, MySQL is generally secure when configured correctly. Here is what you need to know about its built-in protections, common vulnerabilities, and how to harden it for production.

Built-in Security Features

caching_sha2_password default authentication plugin
SSL/TLS support for encrypted connections
Privilege system with granular GRANT options
MySQL Enterprise Audit for comprehensive logging
Data-at-rest encryption for InnoDB tablespaces

Common Vulnerabilities

Root account without password on default installations
SQL injection through application-layer dynamic queries
Unencrypted replication traffic between primary and replicas
Excessive GRANT ALL privileges on application accounts
Exposed MySQL port (3306) to public internet

Hardening Checklist

1Run mysql_secure_installation immediately after installation
2Disable remote root login and set strong root password
3Enable require_secure_transport for mandatory TLS connections
4Create application accounts with minimum required privileges
5Use bind-address=127.0.0.1 and firewall rules for access control
6Enable binary log encryption and audit logging
7Disable LOCAL INFILE to prevent file read attacks
8Remove test database and anonymous user accounts
9Configure validate_password plugin for strong password policies
10Enable general and slow query logs for monitoring

Frequently Asked Questions

Is MySQL secure?

Yes, MySQL is generally secure when configured correctly. It includes built-in protections like caching_sha2_password default authentication plugin. However, common misconfigurations and development patterns can introduce vulnerabilities.

What are the main security risks with MySQL?

The most common MySQL security risks include root account without password on default installations, sql injection through application-layer dynamic queries, unencrypted replication traffic between primary and replicas.

How do I harden MySQL for production?

Key hardening steps: Run mysql_secure_installation immediately after installation. Disable remote root login and set strong root password. Enable require_secure_transport for mandatory TLS connections. Run a security check on your domain to identify specific issues.

Check if your MySQL application has these vulnerabilities

Free security check — SSL, headers, DNS, email authentication, and more. No signup required.

Free Security Check