Mafiree logo
  • About
  • Services
  • Blogs
  • Careers
  • Products
    • orbit logo Orbit
    • streamer logo Xstreami
  • Contact
Schedule a Call
Menu
  • About
  • Services
  • Blogs
  • Careers
  • Products
    • orbit logo Orbit
    • streamer logo Xstreami
  • Contact
  • Schedule a Call
Database
Database Database Managed Services
MySQL MySQL
MySQL Consulting Services
MySQL Migration Services
MySQL Optimization & Query Tuning
MySQL Database Administration
MySQL Backup & Recovery
MySQL Security & Maintenance
MySQL Cloud Services (AWS RDS, Aurora, Google Cloud SQL, Azure)
MySQL for Ecommerce
MySQL High Availability & Replication
MongoDB MongoDB
MongoDB Consulting Services
MongoDB Migration Services
MongoDB Optimization & Query Tuning
MongoDB Database Administration
MongoDB Backup & Recovery
MongoDB Security & Maintenance
MongoDB Cloud (Atlas)
MongoDB Solutions by Industry
MongoDB High Availability & Replication
PostgreSQL PostgreSQL
PostgreSQL Consulting
PostgreSQL Migration & Upgrades
Performance Tuning & Query Optimization
PostgreSQL Administration & Managed Services
High Availability, Clustering & Replication
PostgreSQL Backup, Recovery & Disaster Planning
PostgreSQL Security, Compliance & Auditing
PostgreSQL for Analytics & Data Warehousing
PostgreSQL on Cloud & Containers
PostgreSQL Extensions & Open-Source Integrations
PostgreSQL for Every Industry
SQL Server MSSQL
MSSQL Consulting Services
MSSQL Migration Services
MSSQL Optimization & Query Tuning Services
MSSQL Database Administration Services
MSSQL Backup & Recovery Services
MSSQL High Availability & Replication Services
MSSQL Security & Compliance Services
MSSQL Performance Monitoring & Health Checks
MSSQL Solutions by Industry
Aerospike Aerospike
Aerospike Consulting Services
Aerospike Migration Services
Aerospike Performance Optimization & Tuning
Aerospike Database Administration
Aerospike Backup & Recovery
Aerospike High Availability
Aerospike Cloud & Hybrid Deployments
Aerospike for Real-Time Applications (AdTech, FinTech, Retail, IoT)
Analytics DB
Analytics DB Analytics DB Services
Clickhouse Clickhouse
ClickHouse Consulting Services
ClickHouse Migration Services
ClickHouse Optimization & Query Tuning
ClickHouse Database Administration
ClickHouse Backup & Recovery
ClickHouse Security & Maintenance
ClickHouse Cloud Services (ClickHouse Cloud, AWS, GCP, Azure)
ClickHouse Solutions by Industry
ClickHouse High Availability & Replication
TiDB TiDB
TiDB Consulting & Architecture Planning
TiDB Administration & Maintenance
TiDB Security and Privacy Maintenance
TiDB Performance & Query Optimization
TiDB Migration Services
TiDB Backup & Disaster Recovery
TiDB High Availability Solutions
TiDB Solutions by Industry
TiDB Cloud Services
ScyllaDB ScyllaDB
ScyllaDB Consulting & Architecture Planning
ScyllaDB Administration & Maintenance
ScyllaDB Security and Privacy Maintenance
ScyllaDB Performance & Query Optimization
ScyllaDB Migration Services
ScyllaDB Backup & Disaster Recovery
ScyllaDB High Availability Solutions
ScyllaDB Solutions by Industry
ScyllaDB Cloud Services
DevOps
DevOps DevOps Services
Version Control Version Control
Kubernetes Kubernetes
Infrastructure Infrastructure Management
Web Servers Web Servers
Networking
Networking Networking Services
Basic Basic
Advanced Advanced
MySQL MySQL
MongoDB MongoDB
PostgreSQL PostgreSQL
MSSQL MSSQL
Aerospike Aerospike
Clickhouse Clickhouse
TiDB TiDB
ScyllaDB ScyllaDB
Version Control Version Control
Kubernetes Kubernetes
Infrastructure Infrastructure Management
Web Servers Web Servers
Basic Basic
Advanced Advanced
MySQL Consulting Services
MySQL Migration Services
MySQL Optimization & Query Tuning
MySQL Database Administration
MySQL Backup & Recovery
MySQL Security & Maintenance
MySQL Cloud Services (AWS RDS, Aurora, Google Cloud SQL, Azure)
MySQL for Ecommerce
MySQL High Availability & Replication
MongoDB Consulting Services
MongoDB Migration Services
MongoDB Optimization & Query Tuning
MongoDB Database Administration
MongoDB Backup & Recovery
MongoDB Security & Maintenance
MongoDB Cloud (Atlas)
MongoDB Solutions by Industry
MongoDB High Availability & Replication
PostgreSQL Consulting
PostgreSQL Migration & Upgrades
Performance Tuning & Query Optimization
PostgreSQL Administration & Managed Services
High Availability, Clustering & Replication
PostgreSQL Backup, Recovery & Disaster Planning
PostgreSQL Security, Compliance & Auditing
PostgreSQL for Analytics & Data Warehousing
PostgreSQL on Cloud & Containers
PostgreSQL Extensions & Open-Source Integrations
PostgreSQL for Every Industry
MSSQL Consulting Services
MSSQL Migration Services
MSSQL Optimization & Query Tuning Services
MSSQL Database Administration Services
MSSQL Backup & Recovery Services
MSSQL High Availability & Replication Services
MSSQL Security & Compliance Services
MSSQL Performance Monitoring & Health Checks
MSSQL Solutions by Industry
Aerospike Consulting Services
Aerospike Migration Services
Aerospike Performance Optimization & Tuning
Aerospike Database Administration
Aerospike Backup & Recovery
Aerospike High Availability
Aerospike Cloud & Hybrid Deployments
Aerospike for Real-Time Applications (AdTech, FinTech, Retail, IoT)
ClickHouse Consulting Services
ClickHouse Migration Services
ClickHouse Optimization & Query Tuning
ClickHouse Database Administration
ClickHouse Backup & Recovery
ClickHouse Security & Maintenance
ClickHouse Cloud Services (ClickHouse Cloud, AWS, GCP, Azure)
ClickHouse Solutions by Industry
ClickHouse High Availability & Replication
TiDB Consulting & Architecture Planning
TiDB Administration & Maintenance
TiDB Security and Privacy Maintenance
TiDB Performance & Query Optimization
TiDB Migration Services
TiDB Backup & Disaster Recovery
TiDB High Availability Solutions
TiDB Solutions by Industry
TiDB Cloud Services
ScyllaDB Consulting & Architecture Planning
ScyllaDB Administration & Maintenance
ScyllaDB Security and Privacy Maintenance
ScyllaDB Performance & Query Optimization
ScyllaDB Migration Services
ScyllaDB Backup & Disaster Recovery
ScyllaDB High Availability Solutions
ScyllaDB Solutions by Industry
ScyllaDB Cloud Services
  1. Home
  2. > Blogs
  3. > MySQL
  4. > Stop Hackers at the Gate: Restricting Brute-Force Attacks with MySQL’s Connection Control Plugin

Stop Hackers at the Gate: Restricting Brute-Force Attacks with MySQL’s Connection Control Plugin

“Fortify Your MySQL Security: Slow Down Attackers with Connection Control Plugin” Learn how the MySQL Connection Control Plugin helps defend against brute-force login attempts by introducing intelligent, progressive delays—without locking out legitimate users.

Jenishker August 12, 2025

Subscribe for email updates

Why MySQL Connection Control Plugin ?

 

Security is a top concern for any database administrator, especially when your MySQL server is exposed to external traffic or connected to public networks. Attackers often target port 3306 with brute-force or automated connection attempts, trying to guess user credentials or flood the server with invalid connections.

The MySQL Connection Control Plugin is designed to address exactly this kind of scenario.

 

By introducing progressive delays after a configurable number of failed login attempts, this plugin helps to:

  • Slow down brute-force attacks on MySQL user accounts
  • Discourage automated login attempts from bots or malicious scripts
  • Provide audit visibility via a system table of failed login attempts

In short, the Connection Control Plugin is a simple but powerful tool every MySQL DBA should consider enabling in their defense strategy.
 

What is MySQL Connection Control Plugin ?

 

The Connection Control Plugin is a built-in MySQL security feature that helps protect your server from repeated failed login attempts — often caused by brute-force attacks or bots.

 

It keeps track of failed logins, and once a set limit is reached, it adds a delay before allowing more attempts from the same source. The delay increases with each failure, making automated attacks slower and much less effective.

 

It consists of two parts:

  1. CONNECTION_CONTROL – The core plugin that introduces the connection delay mechanism.
  2. CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS – Tracks failed login attempts per user and host, available in the information_schema.

Installization

You can either load it via my.cnf, or use an interactive SQL session like below:

 

[MYSQLD]
#connection_plugins
plugin-load-add=connection_control.so
plugin-load-add=connection_control_failed_login_attempts.so
mysql> INSTALL PLUGIN CONNECTION_CONTROL SONAME 'connection_control.so';
Query OK, 0 rows affected (0.03 sec)
mysql> INSTALL PLUGIN CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS SONAME 'connection_control.so';
Query OK, 0 rows affected (0.01 sec)

Once installed, the plugin can be listed from Information_Schema:

mysql> SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME LIKE 'connection%';
+------------------------------------------+---------------+
| PLUGIN_NAME                              | PLUGIN_STATUS |
+------------------------------------------+---------------+
| CONNECTION_CONTROL                       |        ACTIVE |
| CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS |        ACTIVE |
+------------------------------------------+---------------+
2 rows in set (0.00 sec)

Plugin Configuration
Once the Connection Control Plugin is installed, you can configure it to suit your security needs. These settings allow you to define how many failed login attempts are allowed before MySQL starts applying a progressive delay between new connection attempts.

mysql> SET GLOBAL connection_control_failed_connections_threshold = 2;
Query OK, 0 rows affected (0.00 sec)
mysql> SET GLOBAL connection_control_min_connection_delay = 3000;
Query OK, 0 rows affected (0.00 sec)

Block aggressive retries after 2 failed attempts and introduce a 3-second delay.

Note:The delay is in milliseconds, not microseconds.

 

Login Attempt Handling with Connection Control Plugin (flow chart)

 

Tracking Login Attempts
The Connection Control Plugin keeps track of failed login attempts and stores them in an internal table. You can monitor this information using the information_schema.

Before attempting failed login

mysql> SELECT * FROM information_schema.connection_control_failed_login_attempts;
Empty set (0.00 sec)

This confirms there are currently no failed login attempts recorded

 

Let’s simulate multiple failed login attempts to see the plugin in action. In this example, we will trigger 10 failed login attempts from the same client IP using incorrect credentials.

Result:-
As you can see, the first two attempts respond quickly, but starting from the 3rd attempt, the delay increases progressively. 

2 failed attempts allowed without delay

From the 3rd attempt onward, delay starts at 3 seconds and increases

jenishkar@ubuntu:~/mysql$ ./sec.sh
Sat Jun 21 11:21:58 IST 2025
0.005
Sat Jun 21 11:21:58 IST 2025
0.004

Sat Jun 21 11:21:58 IST 2025
3.004
Sat Jun 21 11:22:08 IST 2025
4.005

This behavior is exactly what we configured.

Monitoring Failed Login Attempts

// 3 failed attempt

mysql> SELECT * FROM information_schema.connection_control_failed_login_attempts;
+--------------------+-----------------+
| USERHOST           | FAILED_ATTEMPTS |
+--------------------+-----------------+
| 'unknownuser'@'%'  | 3               |
+--------------+-----------------------+
1 row in set (0.00 sec)

Even after many failed login attempts, the plugin does not permanently block access. It only delays connection attempts.

jenishkar@ubuntu:~/mysql$ ./bin/mysql -u unknownuser -p --socket=/tmp/MySQL06.sock 
Enter password: 
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 58
Server version: 8.0.33 MySQL Community Server - GPL

mysql> SELECT * FROM information_schema.connection_control_failed_login_attempts;
Empty set (0.25 sec)

After the successful login it will clear the cache.


Conclusion
At Mafiree, we use the MySQL Connection Control Plugin to protect against brute-force attacks by introducing smart delays after repeated login failures. By leveraging powerful built-in MySQL features, we help keep our client's databases secure, stable, and well-protected.

Leave a Comment

Related Blogs

MySQL Schema Migration Without Downtime: A Real Fintech Case Study

Schema changes on large MySQL tables can bring production systems to a halt if not handled correctly. This case study walks through how Mafiree helped a fintech client execute a zero-downtime MySQL schema migration on a 500M+ row production database — covering the real challenges faced, the three-phase tool strategy using gh-ost, pt-online-schema-change, and MySQL 8.0 INSTANT DDL, production configuration settings with performance benchmarks, and best practices for safely evolving your MySQL schema without impacting users

  828 views
MySQL Architecture Explained: Performance Tuning & Troubleshooting Guide

MySQL features a unique tiered architecture that separates query processing from data storage through its pluggable storage engine model. This guide explores the core components—from connection handling and the SQL optimizer to the physical storage of data on disk. By understanding how engines like InnoDB provide ACID compliance and row-level locking, you can significantly improve your database's scalability. We also break down the query execution workflow and provide actionable tips for performance tuning, such as optimizing the buffer pool. Whether you're managing a replica set or a standalone instance, mastering MySQL’s internal structure is essential for building high-performance applications.

  605 views
The Evolution of MariaDB : Latest Features and What It Offers Compared to MySQL

Discover how MariaDB 11.x is redefining open-source databases with cutting-edge features like system-versioned tables, native AI-ready vector support, UUIDv7 for scalable inserts, and enterprise-grade security—all in the Community Edition, without the paywall.

  2398 views
8 Major MySQL 8.4 Changes That Every Team Should Review Before Migration

Explore the 8 critical changes in MySQL 8.4 you need to know before migrating your production environment. From authentication updates to InnoDB defaults, this release brings significant operational implications for developers and DBAs.

  9181 views
Load Balancing in MySQL: Read and Write Traffic Optimization Using MySQL Router

Optimize MySQL traffic with MySQL Router — smart load balancing made easy

  2300 views

Subscribe for email updates

Get in touch with us

Highlights

More than 6000 Servers Monitored

Happy Clients

Certified DBAs

24 x 7 x 365 Support

PCI

Database Services

MySQL MongoDB PostgreSQL SQL Server Aerospike Clickhouse TiDB MariaDB Columnstore

Quick Links

Careers Blog Contact Privacy Policy Disclaimer Policy

Contacts

Linkedin Mafiree Facebook Mafiree Twitter Mafiree

Nagercoil Office

Miru IT Park, Vallankumaranvillai,

Nagercoil, Tamilnadu - 629 002.

Bangalore Office

Unit 303, Vanguard Rise,

5th Main, Konena Agrahara,

Old Airport Road, Bangalore - 560 017.

Call: +91 6383016411

Email: sales@mafiree.com


Copyright © - All Rights Reserved - Mafiree