0

I am using MySQLi for my webapp but whenever I want to visit some particular page, I get mysqli_connect() [function.mysqli-connect]: (42000/1203): User ***_user already has more than 'max_user_connections' active connections.

I tried already to close all connections but this does not improve the situation.

Is there a way to know exactly what connections are open at any particular moment or any other useful data that can help me resolve this issue ?

BTW, I'm using PHP 5.2.17 and MySQL 5.1.

ahmed
  • 313
  • 3
  • 15

1 Answers1

-1

You might want to supply us with a little more code.

Use SHOW STATUS WHERE 'variable_name' = 'Threads_connected'; to show you all open connections.

You should always close connections that are not needed anymore. If you work with classes, create __destruct function that closes the connection.

If there is no possibility to close the connection or solution of your problem by closing the connections use set max_user_connections to a number that is at least as high as the number of connections to your db is

qsi
  • 683
  • 1
  • 7
  • 16
  • It turns that the `max_user_connections` is set to 3 at my free web host (this is only for tests and I'm upgrading very soon). Now regarding the `SHOW STATUS` command, it gives me a different non-zero number every time (even when I am not using the app), which is weird since the app is protected and nobody but me is using it. Note that the number is also greater than `max_user_connections`. What does all of this mean ? – ahmed Jul 28 '13 at 14:13