PmaControl logo PmaControl
  • Home
  • PmaControl
    • AI Agents 13 on-premise agents
    • Plans Community, Cloud, On-Premise, Premium
    • Documentation Guides, API, architecture
    • Changelog Every stable 5.x release
    • Marketplace Community plugins
    • Clients 28+ companies
    • FAQ 25 questions / 7 categories
    Databases
    • MariaDB 35 articles
    • MySQL 15 articles
    • Galera Cluster 6 articles
    • MaxScale 4 articles
    • ProxySQL 3 articles
    • Amazon Aurora MySQL 0 article
    • Azure Database 0 article
    • ClickHouse 0 article
    • GCP CloudSQL 0 article
    • Percona Server 0 article
    • SingleStore 0 article
    • TiDB 0 article
    • Vitess 0 article
    Solutions
    • Support 24×7 MariaDB & MySQL emergencies
    • Observabilité SQL Monitoring, alerts, topology
    • Haute disponibilité Replication, failover, Galera
    • Disaster Recovery Backup, restore, RPO/RTO
    • Sécurité & conformité Audit, GDPR, SOC2
    • Migration & upgrade Zero downtime, pt-osc, gh-ost
  • Plans
  • Resources
    • Documentation Technical guides & API
    • MySQL optimization center Markdown index, metrics, parameters, incidents
    • FAQ 25 frequently asked questions
    • Testimonials Client feedback & use cases
    • Blog Articles & insights
    • Roadmap Upcoming features
    Areas of expertise
    • Observabilité SQL Monitoring, alerts, Dot3 topology
    • Haute disponibilité Replication, failover, Galera
    • Sécurité & conformité Audit, GDPR, SOC2, ISO 27001
    • Disaster Recovery Backup, restore, RPO/RTO
    • Performance & optimisation Digests, EXPLAIN, tuning
    • Migration & upgrade Zero downtime, pt-osc
    Quick links
    • GitHub Wiki 26 pages — install, engine, plugins
    • Source code Official GitHub repository
    • Support 24×7 MariaDB & MySQL emergencies
    • Book a demo 30 min — real architecture
  • Support 24×7
  • Book a demo
Book a demo
🇫🇷 FR Français 🇬🇧 EN English 🇵🇱 PL Polski 🇷🇺 RU Русский 🇨🇳 ZH 中文 🇸🇦 AR العربية
Resources › MySQL optimization center › MySQL Security Checks

MySQL Security Checks

Structured Markdown documentation to diagnose, measure, and optimize MySQL.

This page is original PmaControl documentation. It keeps a practical index structure for MySQL optimization work, without copying third-party content or depending on an external product.

Objective

MySQL security checks reduce attack surface: overpowered accounts, unencrypted connections, weak passwords, unnecessary global privileges, and network exposure.

Priority Checks

  1. Anonymous accounts or accounts without a password.
  2. Users with unjustified SUPER, FILE, PROCESS, GRANT OPTION, or global privileges.
  3. % access where a precise host is enough.
  4. TLS not enforced for sensitive flows.
  5. local_infile enabled without need.
  6. Binary logs and backups readable by overly broad system accounts.

Basic SQL

SELECT user, host, account_locked, password_expired
FROM mysql.user
ORDER BY user, host;

SHOW GRANTS FOR 'app_user'@'%';

Key Point

The rule is simple: every privilege needs an owner, a justification, and a lifetime.

Define scope and collect account evidence

Inventory database servers, proxies, application accounts, administrators, replicas and backup tools. Associate every account with an owner and intended source host. The following account columns apply to MySQL; MariaDB stores account information differently depending on version. Use a suitably authorized audit account and avoid exporting password hashes or credentials into reports.

SELECT VERSION() AS server_version,
       CURRENT_USER() AS matched_account, USER() AS connection_identity;

SELECT user, host, plugin, account_locked, password_expired, ssl_type
FROM mysql.user
ORDER BY user, host;

SELECT grantee, privilege_type, is_grantable
FROM information_schema.user_privileges
ORDER BY grantee, privilege_type;

CURRENT_USER() identifies the account used for privilege checks; USER() describes the connection identity. The global-privilege inventory is incomplete by itself: inspect SHOW GRANTS for database/table privileges, dynamic privileges and assigned roles, including default/active roles. An empty authentication string is not sufficient proof of an insecure account because authentication plugins differ. Verify the plugin, host restriction, locking state and actual authentication policy.

Verify transport on the actual connection

SHOW GLOBAL VARIABLES WHERE Variable_name IN (
  'require_secure_transport', 'tls_version', 'local_infile',
  'secure_file_priv', 'bind_address', 'port'
);
SHOW SESSION STATUS WHERE Variable_name IN ('Ssl_cipher', 'Ssl_version');

The session TLS fields describe this connection only. A Unix socket can be a valid secure local transport without a TLS cipher. For TCP, check encryption and certificate/hostname verification in the application driver. Test each leg when a proxy terminates TLS: client-to-proxy and proxy-to-server. A server accepting TLS does not mean that all clients require it.

mysql --host=db.example --user=app_reader --password \
  --ssl-mode=VERIFY_IDENTITY --ssl-ca=/path/to/ca.pem

This MySQL-client example prompts for the password and verifies identity; replace the host and CA path. Check the connector’s own options for other clients. Plan certificate rotation and test new application connections before enforcing a new policy, so existing sessions do not hide a reconnect failure.

Review exposure beyond SQL privileges

Control Evidence to retain
Network access Listener, firewall and reachability from intended sources
Files and backups Permissions, encryption, key custody and restore access
Audit and secrets Protected logs, retention, credential rotation and removal of stale accounts

Apply least privilege by job: separate normal application traffic, migrations, monitoring and backup. Test privilege removals and host restrictions with fresh connections, retain the original grants for rollback, and monitor denied operations. Update server and connector versions through a documented upgrade path; authentication-plugin support is version-dependent. A security review must end with an owner, remediation date and verified result for each finding.

Continue the investigation

  • Include security findings in the evaluation page, and verify operational readiness with health checks.

Official references

  • MySQL encrypted connections
  • MySQL SHOW GRANTS
PmaControl
+33 6 63 28 27 47 contact@pmacontrol.com
Legal notice GitHub Contact
Do not wait for an incident to understand your architecture. © 2014-2026 PmaControl — 68Koncept