I have a rather embarrassing problem. While debugging a web app, I suddenly found I was not retrieving items from the database. I went to the command line to log into MySQL and got back "Error 1040: Too many connections." This was when I realized I'd forgotten to include a call to mysqli::close() in my PHP script. This has never been a problem before -- PHP is supposed to close the DB connection at the end of the script, if I'm not mistaken.

In any case, it's fixed now, but in the meantime I can't connect to my DB. Is there any way for me to close my lingering old connections?

You can use:
mysqladmin flush-hosts
That command drops dead connections.

Thanks for the advice! They must have timed out after while, so I managed to get back in. But I left the thread open 'cause I wanted to know what to do should I ever encounter that problem again. Thanks again =)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.