Any way to limit the number of connection to mysql for a command
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).