Hi everybody .
This is very urgent because my Site is down without MySQL and I can't find the cause in my php-scripts :-(

Every day (about 5 a clock in the morning) MySQL refuses for my scripts to connect to the MySQL database. The following message appears:

MySQL Connection Failed: Host 'zeus.i3-service.de' is blocked because of many connection errors. Unblock with 'mysqladmin flush-hosts' in /home/w/weblogmining.de/public_html/kultpower/galeries/galery.inc.php3 on line 43

I think this is a very common problem but I really cannot find the cause for this error. I thought that it is because of the missing "mysql_close" command, so I added it to every php script, but today the error occured again.

Does anybody know what can be the cause of this error??? PLEASE HELP!
THANK YOU!!!

    • [deleted]

    Oh... urgent... yeah... ok right...
    Not urgent enough for you to get reading the F'ing manual though I guess.

    --quote from the MySQL manual --

    19.2.3 Host '...' is blocked error

    If you get a error like this:

    Host 'hostname' is blocked because of many connection errors.
    Unblock with 'mysqladmin flush-hosts'

    This means that mysqld has gotten a lot (max_connect_errors) of connect requests from the host 'hostname' that have been interrupted in the middle. After
    max_connect_errors failed requests, mysqld assumes that something is wrong (like a attack from a cracker), and blocks the site from further connections until
    someone executes the command mysqladmin flush-hosts.

    By default, mysqld blocks a host after 10 connection errors. You can easily adjust this by starting the server like this:

    shell> safe_mysqld -O max_connect_errors=10000 &

    Note that if you get this error message for a given host, you should first check that there isn't anything wrong with TCP/IP connections from that host. If your TCP/IP
    connections aren't working, it won't do you any good to increase the value of the max_connect_errors variable!

    -- end quote --

      Well, of course I read the f*ing manual, but i still do not know the cause for the error...

      Is it normal for MySQL to "produce" so many errors while trying to connect? Can I do something against this? Or is the only possibility to rise the "max_connect_errors" or to execute a "flush-hosts" ?

      Thanx :-)

        • [deleted]

        Ofcourse it's not normal for MySQL to give errors while you try to connect.
        It's up to you to make sure that you connect using a valid username and password, and to make sure that your network connection to the database server is reliable.
        Check if you are indeed allways using the right user/pw, and check to see if you are getting a connection within the max_execution_time of the PHP script.

          9 months later

          I am trying to get into popcap.com to play a game and it won't let me connect can you help me

            2 months later

            Thats because to many tread doesn't closed properly.
            maybe Try using mysql_pconnect();

              • [deleted]

              PHP always closes the connection cleanly, even if you don't use mysql_close().

                are you sure that php always close connection properly, even not use mysql_close?
                so what it's used for? 🙁

                  • [deleted]

                  Yes I am sure :-)

                  mysql_close() is used to close the connection when you nolonger need it.

                  If you forget to use mysql_close() to close the connection, then PHP will close the connection for you. But this is a failsafe, you should never depend on PHP to close the connections, always do it yourself.

                    Hello out there!

                    The problem was not really still urgent, I started this thread nearly ONE YEAR ago :-)

                    Thanks anyway!

                      Write a Reply...