mysqlmysql-error-1040

MySQL Too Many Connections on Windows -- can't flush-hosts


I have a MySql install on Windows Server 2008 which has hit its max connections threshold. As such, whenever I try to login to it, I see 'error 1040: too many connections.' I have Administrator access to the Windows server.

I'm unable to login via the MySql Administrator tool, and I am unable to execute commands such as:

mysqladmin.exe flush-hosts

When I try the above, I simply receive the 'too many connections' error. I have tried specifying the -uroot flag but this doesn't seem to have helped.

As such, I have no idea how to fix this issue. Any advice appreciated.


Solution

  • According to what I found in the net, it looks like you might have to restart the mysql demon (which when you cannot connect with mysqladmin might be a problem in it self, I am not experienced enough to know the best way to shut MySql down in such situations), except you have an admin-account with super privilege. This account should be able to login and do the flush-hosts. But this does not seem to be a default privilege for root, so you would have to grant it before this kind of problem occurs. See this chapter "C.5.2.7. Too many connections" in the Mysql Reference Manual for more detailed information about this, there is also a hard limit mentioned for windows platforms: (open tables × 2 + open connections) < 2048.

    Depending on the system-architecture that uses the database there might be other possibilities - e.g. you might be able to close connections from the client-side by shutting down an application.