Any way to limit the number of connection to mysql for a command I am on Centos 6 and mysql version is 5.6. -
I have several relatively large tables and when I try to run a command it takes up all the connections to the database so the site gets down and I'll get this error:


SQLSTATE[HY000] [1040] Too many connections ...


Lets say I want to run this command:

CREATE TABLE tbl_new AS SELECT * FROM tbl_old;


Is there anyway that I can limit the number of connection that this command takes to mysql?
Hm, unless mysql works like any other database I know...

one command takes exactly ONE connection.

The error is not your command, the error is having and keeping too many connections open (application error), likely by not properly closing them and forgetting about them.

But one command runs on one connection. Period.

You basically ask how to avoid a traffic jam in front of your house by limiting the pizza you ordered to only come with one car - which it always does (because you only ordered one pizza anyway).