1

problem with mysql_connect() function .. when visitor load image in subject cause this Error

Too many connections

code number: 1040

and the max_connections is 500

PLZ what can i do ? change this value to 1024 ?

SET GLOBAL max_connections = 1024;

Or what ?? but why this problem Happen ??

Community
  • 1
  • 1
GoldenFingers
  • 119
  • 1
  • 2
  • 10

1 Answers1

1

1- Open your MySql client, e.g. SQLyog.

2- Run the following command to see how many concurrent connections is MySql server currently allowing:

SHOW VARIABLES LIKE "max_connections";

3- Run the following command to increase the number of concurrent connections:

SET GLOBAL max_connections = 1000;

Another approach is:

Look in and modify your my.cnf file to change the max # of connections - watch out for memory/load issues.

PS: Whenever you open a MySQL connection, close it with mysql_close().

Pupil
  • 23,834
  • 6
  • 44
  • 66