{"id":11509,"date":"2025-05-27T05:01:45","date_gmt":"2025-05-27T05:01:45","guid":{"rendered":"https:\/\/mainvps.net\/blog\/?p=11509"},"modified":"2026-03-17T05:39:41","modified_gmt":"2026-03-17T05:39:41","slug":"protect-mysql-with-fail2ban-security-guide","status":"publish","type":"post","link":"https:\/\/mainvps.net\/blog\/protect-mysql-with-fail2ban-security-guide\/","title":{"rendered":"How to Protect MySQL with Fail2Ban (Step-by-Step Guide for 2026)"},"content":{"rendered":"\r\n<article class=\"text-token-text-primary w-full focus:outline-none [--shadow-height:45px] has-data-writing-block:pointer-events-none has-data-writing-block:-mt-(--shadow-height) has-data-writing-block:pt-(--shadow-height) [&amp;:has([data-writing-block])&gt;*]:pointer-events-auto scroll-mt-(--header-height)\" dir=\"auto\" tabindex=\"-1\" data-turn-id=\"9427ac7b-3a44-4078-bd0d-82d9b0a6bc30\" data-testid=\"conversation-turn-53\" data-scroll-anchor=\"false\" data-turn=\"user\"><\/article>\r\n<article class=\"text-token-text-primary w-full focus:outline-none [--shadow-height:45px] has-data-writing-block:pointer-events-none has-data-writing-block:-mt-(--shadow-height) has-data-writing-block:pt-(--shadow-height) [&amp;:has([data-writing-block])&gt;*]:pointer-events-auto scroll-mt-[calc(var(--header-height)+min(200px,max(70px,20svh)))]\" dir=\"auto\" tabindex=\"-1\" data-turn-id=\"request-69b78f03-08c8-8323-b4b2-13b5fb894756-1\" data-testid=\"conversation-turn-54\" data-scroll-anchor=\"true\" data-turn=\"assistant\">\r\n<div class=\"text-base my-auto mx-auto pb-10 [--thread-content-margin:var(--thread-content-margin-xs,calc(var(--spacing)*4))] @w-sm\/main:[--thread-content-margin:var(--thread-content-margin-sm,calc(var(--spacing)*6))] @w-lg\/main:[--thread-content-margin:var(--thread-content-margin-lg,calc(var(--spacing)*16))] px-(--thread-content-margin)\">\r\n<div class=\"[--thread-content-max-width:40rem] @w-lg\/main:[--thread-content-max-width:48rem] mx-auto max-w-(--thread-content-max-width) flex-1 group\/turn-messages focus-visible:outline-hidden relative flex w-full min-w-0 flex-col agent-turn\" tabindex=\"-1\">\r\n<div class=\"flex max-w-full flex-col gap-4 grow\">\r\n<div class=\"min-h-8 text-message relative flex w-full flex-col items-end gap-2 text-start break-words whitespace-normal [.text-message+&amp;]:mt-1\" dir=\"auto\" data-message-author-role=\"assistant\" data-message-id=\"5a270b71-e0f4-41ca-af00-6be1942eea8b\" data-message-model-slug=\"gpt-5-3\">\r\n<div class=\"flex w-full flex-col gap-1 empty:hidden\">\r\n<div class=\"markdown prose dark:prose-invert w-full wrap-break-word light markdown-new-styling\">\r\n<p data-start=\"0\" data-end=\"773\" data-is-last-node=\"\" data-is-only-node=\"\">Using MySQL on a virtual private server or dedicated server is a good choice for performance and manageability. Still, your database may be an easy target for hackers if not properly secured. This is because databases store critical information such as user information, business data, and application data, which makes them highly valuable to attackers. Although you may have used strong passwords, hackers can still attempt multiple login combinations using automated scripts. Without proper restrictions in place, these repeated attempts could eventually succeed. That\u2019s why it is essential to <strong data-start=\"612\" data-end=\"643\">protect MySQL with Fail2Ban<\/strong>, as it helps automatically detect and block suspicious login attempts, adding a strong layer of security to your database server.<\/p>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/article>\r\n<p>And that\u2019s where Fail2Ban comes in as a key security solution.<\/p>\r\n<p>In this tutorial, we will walk you through how to use Fail2Ban to automatically scan for suspicious behaviour and ban IP addresses that make repeated failed login attempts to your MySQL database. By using Fail2Ban, you will be adding a security layer to your server that can prevent automated attacks. It\u2019s easy to use, highly effective, and a security solution that everyone running a database on their VPS or<a href=\"https:\/\/mainvps.net\/dedicated-servers\" target=\"_blank\" rel=\"noopener\"> dedicated server <\/a>should have.<\/p>\r\n\r\n\r\n\r\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/mainvps.net\/blog\/protect-mysql-with-fail2ban-security-guide\/#Why_Secure_MySQL\" >Why Secure MySQL?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/mainvps.net\/blog\/protect-mysql-with-fail2ban-security-guide\/#What_is_Fail2Ban\" >What is Fail2Ban?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/mainvps.net\/blog\/protect-mysql-with-fail2ban-security-guide\/#What_Makes_Fail2Ban_Awesome\" >What Makes Fail2Ban Awesome?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/mainvps.net\/blog\/protect-mysql-with-fail2ban-security-guide\/#What_Youll_Need\" >What You\u2019ll Need<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/mainvps.net\/blog\/protect-mysql-with-fail2ban-security-guide\/#Step_1_Enable_MySQL_Logging\" >Step 1: Enable MySQL Logging<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/mainvps.net\/blog\/protect-mysql-with-fail2ban-security-guide\/#On_most_systems\" >On most systems:<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/mainvps.net\/blog\/protect-mysql-with-fail2ban-security-guide\/#Step_2_Install_Fail2Ban\" >Step 2: Install Fail2Ban<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/mainvps.net\/blog\/protect-mysql-with-fail2ban-security-guide\/#On_DebianUbuntu\" >On Debian\/Ubuntu:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/mainvps.net\/blog\/protect-mysql-with-fail2ban-security-guide\/#On_CentOSRHEL\" >On CentOS\/RHEL:<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/mainvps.net\/blog\/protect-mysql-with-fail2ban-security-guide\/#Step_3_Configure_the_MySQL_Jail_in_Fail2Ban\" >Step 3: Configure the MySQL Jail in Fail2Ban<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/mainvps.net\/blog\/protect-mysql-with-fail2ban-security-guide\/#Step_4_Activate_the_Filter_If_Not_Already_Available\" >Step 4: Activate the Filter (If Not Already Available)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/mainvps.net\/blog\/protect-mysql-with-fail2ban-security-guide\/#Step_5_Restart_Fail2Ban_Test\" >Step 5: Restart Fail2Ban &amp; Test<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/mainvps.net\/blog\/protect-mysql-with-fail2ban-security-guide\/#Monitoring_Management\" >Monitoring &amp; Management<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/mainvps.net\/blog\/protect-mysql-with-fail2ban-security-guide\/#See_all_active_jails\" >See all active jails:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/mainvps.net\/blog\/protect-mysql-with-fail2ban-security-guide\/#Unban_an_IP\" >Unban an IP:<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/mainvps.net\/blog\/protect-mysql-with-fail2ban-security-guide\/#Pro_Tips_for_Even_Stronger_Security\" >Pro Tips for Even Stronger Security<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/mainvps.net\/blog\/protect-mysql-with-fail2ban-security-guide\/#Final_Thoughts\" >Final Thoughts<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/mainvps.net\/blog\/protect-mysql-with-fail2ban-security-guide\/#FAQs\" >FAQs\u00a0<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-19\" href=\"https:\/\/mainvps.net\/blog\/protect-mysql-with-fail2ban-security-guide\/#Suggestions\" >Suggestions:<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" data-section-id=\"l2nhu9\" data-start=\"1054\" data-end=\"1074\"><span class=\"ez-toc-section\" id=\"Why_Secure_MySQL\"><\/span>Why Secure MySQL?<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<p>MySQL is one of the most popular database management systems in use across the globe. It is used as a backbone for many websites, applications, and internal business systems. From e-commerce websites to content management systems, SaaS applications, and APIs, MySQL is used for storing critical information for many businesses.<\/p>\r\n<p>However, due to its popularity, MySQL is often a victim of many<a href=\"https:\/\/en.wikipedia.org\/wiki\/Cyberattack\" target=\"_blank\" rel=\"nofollow noopener\"> cyber attacks<\/a>. Malicious users often use bots that try to access MySQL servers by guessing usernames and passwords. These types of brute-force attacks often take place in the background and may continue for hours or even days.<\/p>\r\n<p>If these attacks are not properly blocked, they can cause several issues, including:<\/p>\r\n<p><strong>Unauthorized Access:<\/strong> Attackers can access sensitive databases and obtain sensitive information.<\/p>\r\n<p><strong>Data Corruption or Loss:<\/strong> Malicious users can corrupt or delete sensitive information.<\/p>\r\n<p><strong>High Server Resource Usage:<\/strong> Continuous login attempts can cause CPU and network resource usage.<\/p>\r\n<p><strong>Service Downtime:<\/strong> Too much attack traffic can cause downtime for your database service.<\/p>\r\n<p><strong>Reputation Damage:<\/strong> A compromised database can damage the reputation of your business.<\/p>\r\n<p>Therefore, securing MySQL should always be a priority in managing any database server.<\/p>\r\n<ul class=\"wp-block-list\"><\/ul>\r\n<!-- \/wp:post-content -->\r\n\r\n<!-- wp:heading -->\r\n<h2><span class=\"ez-toc-section\" id=\"What_is_Fail2Ban\"><\/span>What is Fail2Ban?<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<p>Fail2Ban is a powerful and lightweight intrusion prevention system for <a href=\"https:\/\/mainvps.net\/blog\/how-to-list-users-in-linux\/\">Linux servers<\/a>. It does this by monitoring system log files for any suspicious activity, such as repeated failed login attempts or unauthorized access.<\/p>\r\n<p>If Fail2Ban detects repeated failed login attempts from a certain IP address, it will automatically block that IP address. This will prevent hackers from continuing their attempts. This will ensure your server is protected from any brute force attacks.<\/p>\r\n<p>Fail2Ban does this by creating something called \u201cjails.\u201d These are essentially services such as <a href=\"https:\/\/mainvps.net\/blog\/ssh-explained-secure-remote-access\/\">SSH<\/a>, MySQL, FTP, or Apache. These services define conditions for banning IPs, the time for which they will be banned, and the action to take in the event that something is detected.<\/p>\r\n<p>Since Fail2Ban is a firewall-based solution, hackers will immediately be denied access to your server. This makes Fail2Ban a very effective solution.<\/p>\r\n<h2 data-section-id=\"1rspwu3\" data-start=\"3398\" data-end=\"3429\"><span class=\"ez-toc-section\" id=\"What_Makes_Fail2Ban_Awesome\"><\/span>What Makes Fail2Ban Awesome?<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<p data-start=\"3431\" data-end=\"3589\">Fail2Ban is widely used by system administrators because it is simple, flexible, and highly effective at protecting servers. Some of the key benefits include:<\/p>\r\n<ul data-start=\"3591\" data-end=\"4503\">\r\n<li data-section-id=\"imjytf\" data-start=\"3591\" data-end=\"3743\">\r\n<p data-start=\"3593\" data-end=\"3743\"><strong data-start=\"3593\" data-end=\"3632\">Works with Most Linux Distributions<\/strong><br data-start=\"3632\" data-end=\"3635\" \/>Fail2Ban is supported on popular distributions such as Ubuntu, Debian, CentOS, AlmaLinux, and Rocky Linux.<\/p>\r\n<\/li>\r\n<li data-section-id=\"117udpk\" data-start=\"3745\" data-end=\"3908\">\r\n<p data-start=\"3747\" data-end=\"3908\"><strong data-start=\"3747\" data-end=\"3786\">Customizable Security Rules (Jails)<\/strong><br data-start=\"3786\" data-end=\"3789\" \/>You can create specific protection rules for different services, including MySQL, SSH, Apache, Nginx, and FTP servers.<\/p>\r\n<\/li>\r\n<li data-section-id=\"41mne4\" data-start=\"3910\" data-end=\"4068\">\r\n<p data-start=\"3912\" data-end=\"4068\"><strong data-start=\"3912\" data-end=\"3946\">Automatic Firewall Integration<\/strong><br data-start=\"3946\" data-end=\"3949\" \/>Fail2Ban automatically updates firewall rules using tools like iptables or firewalld to block malicious IP addresses.<\/p>\r\n<\/li>\r\n<li data-section-id=\"15hkulq\" data-start=\"4070\" data-end=\"4187\">\r\n<p data-start=\"4072\" data-end=\"4187\"><strong data-start=\"4072\" data-end=\"4096\">Real-Time Protection<\/strong><br data-start=\"4096\" data-end=\"4099\" \/>It constantly monitors logs and reacts instantly when suspicious activity is detected.<\/p>\r\n<\/li>\r\n<li data-section-id=\"1jynrt4\" data-start=\"4189\" data-end=\"4350\">\r\n<p data-start=\"4191\" data-end=\"4350\"><strong data-start=\"4191\" data-end=\"4214\">Email Notifications<\/strong><br data-start=\"4214\" data-end=\"4217\" \/>Administrators can configure Fail2Ban to send alerts whenever an IP address is banned, helping you stay aware of potential threats.<\/p>\r\n<\/li>\r\n<li data-section-id=\"lpd20\" data-start=\"4352\" data-end=\"4503\">\r\n<p data-start=\"4354\" data-end=\"4503\"><strong data-start=\"4354\" data-end=\"4383\">Lightweight and Efficient<\/strong><br data-start=\"4383\" data-end=\"4386\" \/>Fail2Ban runs quietly in the background and uses very few system resources, making it perfect for VPS environments.<\/p>\r\n<\/li>\r\n<\/ul>\r\n<p data-start=\"4505\" data-end=\"4674\" data-is-last-node=\"\" data-is-only-node=\"\">With the right configuration, Fail2Ban becomes a powerful security shield that helps protect your MySQL server from brute-force attacks and unauthorized access attempts.<\/p>\r\n<ul class=\"wp-block-list\"><!-- \/wp:heading --><\/ul>\r\n<!-- \/wp:list -->\r\n\r\n<!-- wp:heading -->\r\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_Youll_Need\"><\/span>What You\u2019ll Need<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<!-- \/wp:heading -->\r\n\r\n<!-- wp:paragraph -->\r\n<p>Before we dive in, make sure you have:<\/p>\r\n<!-- \/wp:paragraph -->\r\n\r\n<!-- wp:table -->\r\n<figure class=\"wp-block-table\">\r\n<table class=\"has-fixed-layout\">\r\n<thead>\r\n<tr>\r\n<th>Requirement<\/th>\r\n<th>Description<\/th>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr>\r\n<td>MySQL Installed<\/td>\r\n<td>Running and logging properly<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><a href=\"https:\/\/mainvps.net\/blog\/what-is-linux-server-and-why-does-your-business-need-it\/\">Linux Server<\/a><\/td>\r\n<td>Debian\/<a href=\"https:\/\/mainvps.net\/ubuntu-vps\">Ubuntu<\/a> or RHEL\/<a href=\"https:\/\/mainvps.net\/blog\/migrate-centos-7-to-almalinux-9-production-guide\/\">CentOS<\/a> preferred<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>Root Access<\/td>\r\n<td>For editing configs and installing packages<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>Fail2Ban (we\u2019ll install it)<\/td>\r\n<td>Protects your logs in real-time<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/figure>\r\n<!-- \/wp:table -->\r\n\r\n<!-- wp:quote -->\r\n<blockquote class=\"wp-block-quote\"><!-- wp:paragraph -->\r\n<p>Pro Tip: Make sure MySQL is <strong>not exposed to the internet<\/strong> unless absolutely needed. If it is, then this guide is non-negotiable.<\/p>\r\n<!-- \/wp:paragraph --><\/blockquote>\r\n<!-- \/wp:quote -->\r\n\r\n<!-- wp:heading -->\r\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_1_Enable_MySQL_Logging\"><\/span>Step 1: Enable MySQL Logging<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<!-- \/wp:heading -->\r\n\r\n<!-- wp:paragraph -->\r\n<p>Fail2Ban works by monitoring log files. MySQL needs to log failed login attempts clearly.<\/p>\r\n<!-- \/wp:paragraph -->\r\n\r\n<!-- wp:heading {\"level\":3} -->\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"On_most_systems\"><\/span>On most systems:<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<!-- \/wp:heading -->\r\n\r\n<!-- wp:list {\"ordered\":true} -->\r\n<ol class=\"wp-block-list\"><!-- wp:list-item -->\r\n<li>Edit the MySQL config:<\/li>\r\n<!-- \/wp:list-item --><\/ol>\r\n<!-- \/wp:list -->\r\n\r\n<!-- wp:preformatted {\"style\":{\"typography\":{\"fontSize\":\"18px\"}}} -->\r\n<pre class=\"wp-block-preformatted\" style=\"font-size: 18px;\"><strong><em>bash<\/em><\/strong><br \/><br \/>sudo nano \/etc\/mysql\/mysql.conf.d\/mysqld.cnf<\/pre>\r\n<!-- \/wp:preformatted -->\r\n\r\n<!-- wp:list {\"ordered\":true,\"start\":2} -->\r\n<ol class=\"wp-block-list\" start=\"2\"><!-- wp:list-item -->\r\n<li>Under <code>[mysqld]<\/code>, add:<\/li>\r\n<!-- \/wp:list-item --><\/ol>\r\n<!-- \/wp:list -->\r\n\r\n<!-- wp:preformatted {\"style\":{\"typography\":{\"fontSize\":\"18px\"}}} -->\r\n<pre class=\"wp-block-preformatted\" style=\"font-size: 18px;\"><strong><em>ini<\/em><\/strong><br \/><br \/>log_error_verbosity = 3<\/pre>\r\n<!-- \/wp:preformatted -->\r\n\r\n<!-- wp:list {\"ordered\":true,\"start\":3} -->\r\n<ol class=\"wp-block-list\" start=\"3\"><!-- wp:list-item -->\r\n<li>Restart MySQL:<\/li>\r\n<!-- \/wp:list-item --><\/ol>\r\n<!-- \/wp:list -->\r\n\r\n<!-- wp:preformatted {\"style\":{\"typography\":{\"fontSize\":\"18px\"}}} -->\r\n<pre class=\"wp-block-preformatted\" style=\"font-size: 18px;\"><strong><em>bash<\/em><\/strong><br \/><br \/>sudo systemctl restart mysql<\/pre>\r\n<!-- \/wp:preformatted -->\r\n\r\n<!-- wp:list {\"ordered\":true,\"start\":4} -->\r\n<ol class=\"wp-block-list\" start=\"4\"><!-- wp:list-item -->\r\n<li>Trigger a failed login (on purpose):<\/li>\r\n<!-- \/wp:list-item --><\/ol>\r\n<!-- \/wp:list -->\r\n\r\n<!-- wp:preformatted {\"style\":{\"typography\":{\"fontSize\":\"18px\"}}} -->\r\n<pre class=\"wp-block-preformatted\" style=\"font-size: 18px;\"><strong><em>bash<br \/><\/em><\/strong><br \/>mysql -u wronguser -p<\/pre>\r\n<!-- \/wp:preformatted -->\r\n\r\n<!-- wp:list {\"ordered\":true,\"start\":5} -->\r\n<ol class=\"wp-block-list\" start=\"5\"><!-- wp:list-item -->\r\n<li>Check logs:<\/li>\r\n<!-- \/wp:list-item --><\/ol>\r\n<!-- \/wp:list -->\r\n\r\n<!-- wp:preformatted {\"style\":{\"typography\":{\"fontSize\":\"18px\"}}} -->\r\n<pre class=\"wp-block-preformatted\" style=\"font-size: 18px;\"><strong><em>bash<\/em><\/strong><br \/><br \/>cat \/var\/log\/mysql\/error.log<\/pre>\r\n<!-- \/wp:preformatted -->\r\n\r\n<!-- wp:paragraph -->\r\n<p>You should see something like this:<\/p>\r\n<!-- \/wp:paragraph -->\r\n\r\n<!-- wp:preformatted {\"style\":{\"typography\":{\"fontSize\":\"18px\"}}} -->\r\n<pre class=\"wp-block-preformatted\" style=\"font-size: 18px;\"><strong><em>pgsql<\/em><\/strong><br \/><br \/>[Note] Access denied for user 'wronguser'@'127.0.0.1'<\/pre>\r\n<!-- \/wp:preformatted -->\r\n\r\n<!-- wp:paragraph -->\r\n<p>That\u2019s what Fail2Ban will look for.<\/p>\r\n<!-- \/wp:paragraph -->\r\n\r\n<!-- wp:heading -->\r\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_2_Install_Fail2Ban\"><\/span>Step 2: Install Fail2Ban<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<!-- \/wp:heading -->\r\n\r\n<!-- wp:heading {\"level\":3} -->\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"On_DebianUbuntu\"><\/span>On Debian\/Ubuntu:<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<!-- \/wp:heading -->\r\n\r\n<!-- wp:preformatted {\"style\":{\"typography\":{\"fontSize\":\"18px\"}}} -->\r\n<pre class=\"wp-block-preformatted\" style=\"font-size: 18px;\"><strong><em>bash<\/em><\/strong><br \/><br \/>sudo apt update &amp;&amp; sudo apt install fail2ban -y<\/pre>\r\n<!-- \/wp:preformatted -->\r\n\r\n<!-- wp:heading {\"level\":3} -->\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"On_CentOSRHEL\"><\/span>On CentOS\/RHEL:<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<!-- \/wp:heading -->\r\n\r\n<!-- wp:preformatted {\"style\":{\"typography\":{\"fontSize\":\"18px\"}}} -->\r\n<pre class=\"wp-block-preformatted\" style=\"font-size: 18px;\"><strong><em>bash\r\n<\/em><\/strong>\r\nsudo yum install epel-release -y\r\nsudo yum install fail2ban -y\r\n<\/pre>\r\n<!-- \/wp:preformatted -->\r\n\r\n<!-- wp:paragraph -->\r\n<p>For more, read &#8211; <a href=\"https:\/\/mainvps.net\/blog\/yum-reinstall-repo-management-centos\/\">Mastering yum reinstall and Repository Management on CentOS<\/a><\/p>\r\n<!-- \/wp:paragraph -->\r\n\r\n<!-- wp:paragraph -->\r\n<p>Enable and start the service:<\/p>\r\n<!-- \/wp:paragraph -->\r\n\r\n<!-- wp:preformatted {\"style\":{\"typography\":{\"fontSize\":\"18px\"}}} -->\r\n<pre class=\"wp-block-preformatted\" style=\"font-size: 18px;\">bash<br \/><br \/>sudo systemctl enable --now fail2ban<\/pre>\r\n<!-- \/wp:preformatted -->\r\n\r\n<!-- wp:heading -->\r\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_3_Configure_the_MySQL_Jail_in_Fail2Ban\"><\/span>Step 3: Configure the MySQL Jail in Fail2Ban<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<!-- \/wp:heading -->\r\n\r\n<!-- wp:paragraph -->\r\n<p>Fail2Ban uses &#8220;jails&#8221; to define what logs to watch and how to respond.<\/p>\r\n<!-- \/wp:paragraph -->\r\n\r\n<!-- wp:list {\"ordered\":true} -->\r\n<ol class=\"wp-block-list\"><!-- wp:list-item -->\r\n<li>Create a new jail:<\/li>\r\n<!-- \/wp:list-item --><\/ol>\r\n<!-- \/wp:list -->\r\n\r\n<!-- wp:preformatted {\"style\":{\"typography\":{\"fontSize\":\"18px\"}}} -->\r\n<pre class=\"wp-block-preformatted\" style=\"font-size: 18px;\"><strong><em>bash<\/em><\/strong><br \/><br \/>sudo nano \/etc\/fail2ban\/jail.d\/mysqld.local<\/pre>\r\n<!-- \/wp:preformatted -->\r\n\r\n<!-- wp:list {\"ordered\":true,\"start\":2} -->\r\n<ol class=\"wp-block-list\" start=\"2\"><!-- wp:list-item -->\r\n<li>Paste this config:<\/li>\r\n<!-- \/wp:list-item --><\/ol>\r\n<!-- \/wp:list -->\r\n\r\n<!-- wp:preformatted {\"style\":{\"typography\":{\"fontSize\":\"18px\"}}} -->\r\n<pre class=\"wp-block-preformatted\" style=\"font-size: 18px;\"><strong><em>ini<\/em><\/strong><br \/><br \/>[mysqld-auth]<br \/>enabled = true<br \/>filter = mysqld-auth<br \/>port = 3306<br \/>logpath = \/var\/log\/mysql\/error.log<br \/>maxretry = 5<br \/>findtime = 600<br \/>bantime = 3600<code><br \/><\/code><\/pre>\r\n<!-- \/wp:preformatted -->\r\n\r\n<!-- wp:paragraph -->\r\n<p>This means:<\/p>\r\n<!-- \/wp:paragraph -->\r\n\r\n<!-- wp:list -->\r\n<ul class=\"wp-block-list\"><!-- wp:list-item -->\r\n<li>5 failed attempts in 10 minutes \u2192 1 hour ban.<\/li>\r\n<!-- \/wp:list-item --><\/ul>\r\n<!-- \/wp:list -->\r\n\r\n<!-- wp:heading -->\r\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_4_Activate_the_Filter_If_Not_Already_Available\"><\/span>Step 4: Activate the Filter (If Not Already Available)<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<!-- \/wp:heading -->\r\n\r\n<!-- wp:list {\"ordered\":true} -->\r\n<ol class=\"wp-block-list\"><!-- wp:list-item -->\r\n<li>Check for this file:<\/li>\r\n<!-- \/wp:list-item --><\/ol>\r\n<!-- \/wp:list -->\r\n\r\n<!-- wp:preformatted {\"style\":{\"typography\":{\"fontSize\":\"18px\"}}} -->\r\n<pre class=\"wp-block-preformatted\" style=\"font-size: 18px;\"><strong><em>bash<\/em><\/strong><br \/><br \/>ls \/etc\/fail2ban\/filter.d\/mysqld-auth.conf<\/pre>\r\n<!-- \/wp:preformatted -->\r\n\r\n<!-- wp:paragraph -->\r\n<p>If it&#8217;s not there, create it:<\/p>\r\n<!-- \/wp:paragraph -->\r\n\r\n<!-- wp:preformatted {\"style\":{\"typography\":{\"fontSize\":\"18px\"}}} -->\r\n<pre class=\"wp-block-preformatted\" style=\"font-size: 18px;\"><strong><em>bash<\/em><\/strong><br \/><br \/>sudo nano \/etc\/fail2ban\/filter.d\/mysqld-auth.conf<\/pre>\r\n<!-- \/wp:preformatted -->\r\n\r\n<!-- wp:paragraph -->\r\n<p>Add this:<\/p>\r\n<!-- \/wp:paragraph -->\r\n\r\n<!-- wp:preformatted {\"style\":{\"typography\":{\"fontSize\":\"18px\"}}} -->\r\n<pre class=\"wp-block-preformatted\" style=\"font-size: 18px;\"><strong><em>ini<\/em><\/strong><br \/><br \/>[Definition]<br \/>failregex = Access denied for user .* from '&lt;HOST&gt;'<br \/>ignoreregex =<code><br \/><\/code><\/pre>\r\n<!-- \/wp:preformatted -->\r\n\r\n<!-- wp:paragraph -->\r\n<p>Save and exit.<\/p>\r\n<!-- \/wp:paragraph -->\r\n\r\n<!-- wp:heading -->\r\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_5_Restart_Fail2Ban_Test\"><\/span>Step 5: Restart Fail2Ban &amp; Test<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<!-- \/wp:heading -->\r\n\r\n<!-- wp:preformatted {\"style\":{\"typography\":{\"fontSize\":\"18px\"}}} -->\r\n<pre class=\"wp-block-preformatted\" style=\"font-size: 18px;\"><strong><em>bash<\/em><\/strong><br \/><br \/>sudo systemctl restart fail2ban<\/pre>\r\n<!-- \/wp:preformatted -->\r\n\r\n<!-- wp:paragraph -->\r\n<p>Check status:<\/p>\r\n<!-- \/wp:paragraph -->\r\n\r\n<!-- wp:preformatted {\"style\":{\"typography\":{\"fontSize\":\"18px\"}}} -->\r\n<pre class=\"wp-block-preformatted\" style=\"font-size: 18px;\"><strong><em>bash<\/em><\/strong><br \/><br \/>sudo fail2ban-client status mysqld-auth<\/pre>\r\n<!-- \/wp:preformatted -->\r\n\r\n<!-- wp:paragraph -->\r\n<p>You should see:<\/p>\r\n<!-- \/wp:paragraph -->\r\n\r\n<!-- wp:list -->\r\n<ul class=\"wp-block-list\"><!-- wp:list-item -->\r\n<li>Currently banned IPs<\/li>\r\n<!-- \/wp:list-item -->\r\n\r\n<!-- wp:list-item -->\r\n<li>Number of attempts<\/li>\r\n<!-- \/wp:list-item --><\/ul>\r\n<!-- \/wp:list -->\r\n\r\n<!-- wp:heading -->\r\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Monitoring_Management\"><\/span>Monitoring &amp; Management<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<!-- \/wp:heading -->\r\n\r\n<!-- wp:heading {\"level\":3} -->\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"See_all_active_jails\"><\/span>See all active jails:<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<!-- \/wp:heading -->\r\n\r\n<!-- wp:preformatted {\"style\":{\"typography\":{\"fontSize\":\"18px\"}}} -->\r\n<pre class=\"wp-block-preformatted\" style=\"font-size: 18px;\"><strong><em>bash<\/em><\/strong><br \/><br \/>sudo fail2ban-client status<\/pre>\r\n<!-- \/wp:preformatted -->\r\n\r\n<!-- wp:heading {\"level\":3} -->\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Unban_an_IP\"><\/span>Unban an IP:<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<!-- \/wp:heading -->\r\n\r\n<!-- wp:preformatted {\"style\":{\"typography\":{\"fontSize\":\"18px\"}}} -->\r\n<pre class=\"wp-block-preformatted\" style=\"font-size: 18px;\"><strong><em>bash<\/em><\/strong><br \/><br \/>sudo fail2ban-client set mysqld-auth unbanip YOUR.IP.ADDRESS<\/pre>\r\n<!-- \/wp:preformatted -->\r\n\r\n<!-- wp:heading -->\r\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Pro_Tips_for_Even_Stronger_Security\"><\/span>Pro Tips for Even Stronger Security<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<!-- \/wp:heading -->\r\n\r\n<!-- wp:list -->\r\n<ul class=\"wp-block-list\"><!-- wp:list-item -->\r\n<li>Use <strong>UFW or firewalld<\/strong> to restrict MySQL to trusted IPs.<\/li>\r\n<!-- \/wp:list-item -->\r\n\r\n<!-- wp:list-item -->\r\n<li>Disable remote root login in MySQL:<\/li>\r\n<!-- \/wp:list-item --><\/ul>\r\n<!-- \/wp:list -->\r\n\r\n<!-- wp:preformatted {\"style\":{\"typography\":{\"fontSize\":\"19px\"}}} -->\r\n<pre class=\"wp-block-preformatted\" style=\"font-size: 19px;\"><strong><em>sql<\/em><\/strong><br \/><br \/>UPDATE mysql.user SET host='localhost' WHERE user='root';<\/pre>\r\n<!-- \/wp:preformatted -->\r\n\r\n<!-- wp:list -->\r\n<ul class=\"wp-block-list\"><!-- wp:list-item -->\r\n<li>Change the MySQL port from 3306 to a non-standard port.<\/li>\r\n<!-- \/wp:list-item -->\r\n\r\n<!-- wp:list-item -->\r\n<li>Set up alerts so you get notified on bans:<\/li>\r\n<!-- \/wp:list-item --><\/ul>\r\n<!-- \/wp:list -->\r\n\r\n<!-- wp:preformatted {\"style\":{\"typography\":{\"fontSize\":\"18px\"}}} -->\r\n<pre class=\"wp-block-preformatted\" style=\"font-size: 18px;\"><strong><em>ini<\/em><\/strong><br \/><br \/>action = %(action_mwl)s<\/pre>\r\n<!-- \/wp:preformatted -->\r\n\r\n<!-- wp:heading -->\r\n<article class=\"text-token-text-primary w-full focus:outline-none [--shadow-height:45px] has-data-writing-block:pointer-events-none has-data-writing-block:-mt-(--shadow-height) has-data-writing-block:pt-(--shadow-height) [&amp;:has([data-writing-block])&gt;*]:pointer-events-auto scroll-mt-(--header-height)\" dir=\"auto\" tabindex=\"-1\" data-turn-id=\"606eb595-38c8-4c4e-a748-da8f48f4112b\" data-testid=\"conversation-turn-47\" data-scroll-anchor=\"false\" data-turn=\"user\"><\/article>\r\n<article class=\"text-token-text-primary w-full focus:outline-none [--shadow-height:45px] has-data-writing-block:pointer-events-none has-data-writing-block:-mt-(--shadow-height) has-data-writing-block:pt-(--shadow-height) [&amp;:has([data-writing-block])&gt;*]:pointer-events-auto scroll-mt-[calc(var(--header-height)+min(200px,max(70px,20svh)))]\" dir=\"auto\" tabindex=\"-1\" data-turn-id=\"request-WEB:698782a8-36f8-4d84-8704-4e127f2c9518-23\" data-testid=\"conversation-turn-48\" data-scroll-anchor=\"true\" data-turn=\"assistant\">\r\n<div class=\"text-base my-auto mx-auto pb-10 [--thread-content-margin:var(--thread-content-margin-xs,calc(var(--spacing)*4))] @w-sm\/main:[--thread-content-margin:var(--thread-content-margin-sm,calc(var(--spacing)*6))] @w-lg\/main:[--thread-content-margin:var(--thread-content-margin-lg,calc(var(--spacing)*16))] px-(--thread-content-margin)\">\r\n<div class=\"[--thread-content-max-width:40rem] @w-lg\/main:[--thread-content-max-width:48rem] mx-auto max-w-(--thread-content-max-width) flex-1 group\/turn-messages focus-visible:outline-hidden relative flex w-full min-w-0 flex-col agent-turn\" tabindex=\"-1\">\r\n<div class=\"flex max-w-full flex-col gap-4 grow\">\r\n<div class=\"min-h-8 text-message relative flex w-full flex-col items-end gap-2 text-start break-words whitespace-normal [.text-message+&amp;]:mt-1\" dir=\"auto\" data-message-author-role=\"assistant\" data-message-id=\"489ef6da-8dbc-49a7-b3f3-1c0d21884b1c\" data-message-model-slug=\"gpt-5-3\">\r\n<div class=\"flex w-full flex-col gap-1 empty:hidden\">\r\n<div class=\"markdown prose dark:prose-invert w-full wrap-break-word light markdown-new-styling\">\r\n<h2><span class=\"ez-toc-section\" id=\"Final_Thoughts\"><\/span>Final Thoughts<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<p>Protecting your MySQL server is of utmost importance, especially if it is exposed to the internet or used by applications that are exposed to the public. This is due to the fact that brute-force attacks are common, and they can easily overwhelm an unprotected database server. Fail2Ban, therefore, offers an excellent solution as it will act as an automated shield that will detect repeated failed login attempts and block malicious IP addresses before they can cause significant damage to the database server.<\/p>\r\n<p>Therefore, with the use of strong passwords, <a href=\"https:\/\/en.wikipedia.org\/wiki\/Firewall_(computing)\" target=\"_blank\" rel=\"nofollow noopener\">firewall configurations<\/a>, database access control, and update services, Fail2Ban will be an excellent addition to the overall security of your server. The best part of Fail2Ban, however, is that once it has been properly configured, it will run in the background, constantly monitoring your logs.<\/p>\r\n<h2 data-section-id=\"e3phiy\" data-start=\"0\" data-end=\"42\"><span class=\"ez-toc-section\" id=\"FAQs\"><\/span>FAQs\u00a0<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n<p data-start=\"44\" data-end=\"284\"><strong data-start=\"44\" data-end=\"83\">Q1: Will this work for MariaDB too?<\/strong><br data-start=\"83\" data-end=\"86\" \/>Yes, it works perfectly with MariaDB. Since MariaDB is a fork of MySQL, it uses a very similar logging structure. Fail2Ban can monitor those logs and block suspicious login attempts in the same way.<\/p>\r\n<p data-start=\"286\" data-end=\"550\"><strong data-start=\"286\" data-end=\"319\">Q2: Can I set permanent bans?<\/strong><br data-start=\"319\" data-end=\"322\" \/>Yes, Fail2Ban allows permanent bans by setting <code data-start=\"369\" data-end=\"383\">bantime = -1<\/code> in the configuration. This means the IP address will remain blocked indefinitely. However, permanent bans should be used carefully to avoid blocking legitimate users.<\/p>\r\n<p data-start=\"552\" data-end=\"816\"><strong data-start=\"552\" data-end=\"595\">Q3: What if Fail2Ban isn\u2019t banning IPs?<\/strong><br data-start=\"595\" data-end=\"598\" \/>First, check if MySQL is logging failed login attempts correctly. Then confirm that the log file path in the Fail2Ban configuration is accurate. Finally, verify that the filter rules match the format of your MySQL logs.<\/p>\r\n<p data-start=\"818\" data-end=\"1112\"><strong data-start=\"818\" data-end=\"862\">Q4: Is Fail2Ban enough to protect MySQL?<\/strong><br data-start=\"862\" data-end=\"865\" \/>Fail2Ban provides strong protection against brute-force attacks. However, it should be combined with other security measures such as firewalls, strong passwords, and regular software updates. A layered security approach offers the best protection.<\/p>\r\n<p data-start=\"1114\" data-end=\"1360\"><strong data-start=\"1114\" data-end=\"1161\">Q5: Can I use Fail2Ban with other services?<\/strong><br data-start=\"1161\" data-end=\"1164\" \/>Yes, Fail2Ban supports many services beyond MySQL. It can protect SSH, FTP, web servers like <a href=\"https:\/\/mainvps.net\/blog\/how-to-configure-apache-server-paths-on-almalinux\/\">Apache<\/a> and Nginx, and even email services. You simply need to enable or configure the appropriate jail.<\/p>\r\n<p data-start=\"1362\" data-end=\"1632\"><strong data-start=\"1362\" data-end=\"1409\">Q6: How many failed attempts trigger a ban?<\/strong><br data-start=\"1409\" data-end=\"1412\" \/>This depends on your configuration settings. By default, Fail2Ban bans an IP after several failed login attempts within a specific time period. You can customize the limit using parameters like <code data-start=\"1606\" data-end=\"1616\">maxretry<\/code> and <code data-start=\"1621\" data-end=\"1631\">findtime<\/code>.<\/p>\r\n<p data-start=\"1634\" data-end=\"1909\"><strong data-start=\"1634\" data-end=\"1684\">Q7: Does Fail2Ban block attackers permanently?<\/strong><br data-start=\"1684\" data-end=\"1687\" \/>By default, Fail2Ban blocks attackers temporarily for a specified time period. Once the ban time expires, the IP address can try again. Administrators can increase the ban duration or configure permanent bans if necessary.<\/p>\r\n<p data-start=\"1911\" data-end=\"2147\"><strong data-start=\"1911\" data-end=\"1953\">Q8: Will Fail2Ban slow down my server?<\/strong><br data-start=\"1953\" data-end=\"1956\" \/>No, Fail2Ban is lightweight and consumes very few system resources. It runs quietly in the background while monitoring log files. Even on small <a href=\"https:\/\/mainvps.net\/blog\/how-to-use-vps-as-a-git-server\/\">VPS servers<\/a>, its performance impact is minimal.<\/p>\r\n<p data-start=\"2149\" data-end=\"2416\"><strong data-start=\"2149\" data-end=\"2206\">Q9: Can Fail2Ban block legitimate users accidentally?<\/strong><br data-start=\"2206\" data-end=\"2209\" \/>Yes, if a user repeatedly enters incorrect credentials, their IP may be temporarily banned. However, administrators can manually unban IPs when needed. Adjusting retry limits can also reduce accidental bans.<\/p>\r\n<p data-start=\"2418\" data-end=\"2665\"><strong data-start=\"2418\" data-end=\"2476\">Q10: How can I check which IPs are banned by Fail2Ban?<\/strong><br data-start=\"2476\" data-end=\"2479\" \/>You can view banned IP addresses using the command <code data-start=\"2530\" data-end=\"2554\">fail2ban-client status<\/code>. This shows active jails and blocked IPs. It helps administrators monitor attack attempts and security events.<\/p>\r\n<h3 data-start=\"3398\" data-end=\"3655\"><span class=\"ez-toc-section\" id=\"Suggestions\"><\/span>Suggestions:<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n<ol>\r\n<li><a href=\"https:\/\/mainvps.net\/blog\/linux-reseller-hosting\/\">https:\/\/mainvps.net\/blog\/linux-reseller-hosting\/<\/a><\/li>\r\n<li><a href=\"https:\/\/mainvps.net\/blog\/lifetime-web-hosting-2026\/\">https:\/\/mainvps.net\/blog\/lifetime-web-hosting-2026\/<\/a><\/li>\r\n<li><a href=\"https:\/\/mainvps.net\/blog\/windows-reseller-web-hosting\/\">https:\/\/mainvps.net\/blog\/windows-reseller-web-hosting\/<\/a><\/li>\r\n<li><a href=\"https:\/\/mainvps.net\/blog\/best-wordpress-hosting-providers\/\">https:\/\/mainvps.net\/blog\/best-wordpress-hosting-providers\/<\/a><\/li>\r\n<li><a href=\"https:\/\/mainvps.net\/blog\/linux-vps-hosting-india\/\">https:\/\/mainvps.net\/blog\/linux-vps-hosting-india\/<\/a><\/li>\r\n<li><a href=\"https:\/\/mainvps.net\/blog\/low-cost-windows-vps-hosting-in-india\/\">https:\/\/mainvps.net\/blog\/low-cost-windows-vps-hosting-in-india\/<\/a><\/li>\r\n<li><a href=\"https:\/\/mainvps.net\/blog\/cheap-dedicated-server-hosting-providers\/\">https:\/\/mainvps.net\/blog\/cheap-dedicated-server-hosting-providers\/<\/a><\/li>\r\n<li><a href=\"https:\/\/mainvps.net\/blog\/windows-server-guide-dde-dns-tls-1-2-uptime\/\">https:\/\/mainvps.net\/blog\/windows-server-guide-dde-dns-tls-1-2-uptime\/<\/a><\/li>\r\n<li><a href=\"https:\/\/mainvps.net\/blog\/dedicated-server-hosting-netherlands\/\">https:\/\/mainvps.net\/blog\/dedicated-server-hosting-netherlands\/<\/a><\/li>\r\n<li><a href=\"https:\/\/mainvps.net\/blog\/dedicated-server-low-price\/\">https:\/\/mainvps.net\/blog\/dedicated-server-low-price\/<\/a><\/li>\r\n<li><a href=\"https:\/\/mainvps.net\/blog\/vps-hosting-in-los-angeles-us\/\">https:\/\/mainvps.net\/blog\/vps-hosting-in-los-angeles-us\/<\/a><\/li>\r\n<li><a href=\"https:\/\/mainvps.net\/blog\/dedicated-server-in-nedzone-nl\/\">https:\/\/mainvps.net\/blog\/dedicated-server-in-nedzone-nl\/<\/a><\/li>\r\n<\/ol>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/article>\r\n<!-- \/wp:paragraph -->\r\n\r\n<!-- wp:heading -->\r\n<p>&nbsp;<\/p>\r\n<!-- \/wp:paragraph -->","protected":false},"excerpt":{"rendered":"<p>Using MySQL on a virtual private server or dedicated server is a good choice for performance and manageability. Still, your database may be an easy target <a class=\"read-more-link\" href=\"https:\/\/mainvps.net\/blog\/protect-mysql-with-fail2ban-security-guide\/\">Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":11615,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[200,20],"tags":[],"class_list":["post-11509","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-website-management","category-servers"],"_links":{"self":[{"href":"https:\/\/mainvps.net\/blog\/wp-json\/wp\/v2\/posts\/11509","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mainvps.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mainvps.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mainvps.net\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/mainvps.net\/blog\/wp-json\/wp\/v2\/comments?post=11509"}],"version-history":[{"count":7,"href":"https:\/\/mainvps.net\/blog\/wp-json\/wp\/v2\/posts\/11509\/revisions"}],"predecessor-version":[{"id":12425,"href":"https:\/\/mainvps.net\/blog\/wp-json\/wp\/v2\/posts\/11509\/revisions\/12425"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/mainvps.net\/blog\/wp-json\/wp\/v2\/media\/11615"}],"wp:attachment":[{"href":"https:\/\/mainvps.net\/blog\/wp-json\/wp\/v2\/media?parent=11509"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mainvps.net\/blog\/wp-json\/wp\/v2\/categories?post=11509"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mainvps.net\/blog\/wp-json\/wp\/v2\/tags?post=11509"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}