MYSQL Too many connection errors will not go away

I get the MySQL error "Too many connections" in a C ++ program running on Ubuntu Linux.

This is the code that gets the error (inside the method that returns the mysql error, if any):

MYSQL connect;
mysql_init(&connect);
if (!mysql_real_connect(&connect,SERVER,USER,PASSWORD,DATABASE,0,NULL,0))
{
    return mysql_error(&connect);
}

This code continues to return the string "Too many connections."

I am wondering if this is really some other mistake. This program has been running for several months before I received this error. When the error appeared, it was because I was running the program against several thousand updates / readings, and therefore yes, it is very likely that I used the available connections. The problem is that I cannot find a way to release them, if so.

Here is what I tried:

  • ASSISTANTS FLUSH;
  • FLUSH TABLES;
  • reload MYSQL
  • rebooting the machine as a whole

12 , , , reset/. , - .

+3
2

. C.5.2.7. .

MySQL.

 netstat -apn | grep mysql | grep -i established

  • , null .
  • .
  • / .
  • max_connections=# /etc/mysql/my.cnf MySQL --max_connections=#
+3

, , .

.

0

All Articles