Host 'hostname' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts' Host 'hostname' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts' php php

Host 'hostname' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'


https://dev.mysql.com/doc/refman/5.0/en/blocked-host.html

Your problem is that you are continually attempting to connect and you are failing. The shared server is set to protect itself from this behavior, and has cut you off. Turn off your application for a while and then resolve the connection problem before turning it back on.

The amount of time before you are able to attempt again is set on the server, likely in a place you can not see. So try every 15 minutes for a while until you are allowed the attempt ...

I would suggest a spare mysql server (perhaps locally) to practice with so you can avoid what appears to this host as a brute force attack in the future. Always test your connection manually before "turning on the service".


I had the same problem. But I solved it like this:

  1. Login to your "Domain Admin Panel" (www.yourdomainname.com/cpanel)

  2. Go to "Databases" section and click on "Remote Mysql" option

    enter image description here

  3. In the next page, in "Host (% wildcard is allowed)" text field put "%" and press "Add Host" button

    enter image description here

  4. Now you should see that "%" in the below list and from there you can delete it by pressing "X" button any time.

  5. Now go to your "php Script" file and set your Database Host Name, Without "http://" or "www"

    enter image description here

Now try to reconnect it. Hope it will help you.

Remember:
By doing this, You are allowing external web servers to access your MySQL databases by adding their domain name to the list of hosts that are able to access databases on your web site.


Use "localhost" as db host, if your website is hosted at the same server of the db