Host X is blocked because of many connection errors; unblock with ‘mysqladmin flush-hosts’

For some reason, you might get these error when you execute the MySQL query,

Host '' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts' in /home/mickgenie/public_html/wow.php on line 25
Unable to connect to mysql server

The quick fix but not permanent solution will be running the command as below,

mysqladmin flush-hosts

To fix the issue permanently, edit the file /etc/my.cnf.

Add the following line to the /etc/my.cnf below [mysqld]

set-variable = max_connect_errors=5000

Then restart the MySQL services.

How to Edit Windows Host File?

If you are the webmaster of a website and you often modify your script and update directly from the server, you will need to always check if you are resolved to the correct testing box(servers).

By modify the Windows Host file, you will be able to correctly view the actual result instead of the cache from your PC to the old host (if you have more than 2 hosting servers).

To change your Windows Host File, you may simply use the notepad available from the Windows Operating System, run it as administrator mode if you are running Windows Vista or Windows 7.

Then open the file located at C:\Windows\System32\drivers\etc\hosts. Modify according to your need like example below.

Set SPF records for Google Apps

Nowadays, many user use Google Apps for their own domain such as but they do not know Google Apps did allow them to apply SPF (Sender Policy Framework) to their email to protect spamming issue.

By using SPF records, it allow domain owners to specify which hosts are permitted to send email on behalf of their domains. Normal SMTP allows any computer to send an email claiming to be from anyone. Thus, it’s easy for spammers to send emails with forged From: addresses. SPF allows a domain owner to use a special format of DNS TXT records to specify which machines or hosts are authorized to transmit email for their domain; this makes it difficult to forge From: addresses.

To set your domain’s SPF record, you should have access to your domain’s DNS settings. On your DNS resource, publish the following TXT record: v=spf1 ~all