5

I am trying to develop a program using the MySQL C Connector in Debian.

When ever the program tries to connect using:

if (!mysql_real_connect(connection, "127.0.0.1", "dbuser", "dbpassword", "dbname", 3306, NULL, 0)) {
  printf("Connection error : %s\n", mysql_error(connection));
  exit(1);
}

I just get back "Can't create TCP/IP socket (24)" and if i try:

 if (!mysql_real_connect(connection, "localhost", "dbuser", "dbpassword", "dbname", 0, NULL, 0)) {
  printf("Connection error : %s\n", mysql_error(connection));
  exit(1);
}

I get back "Can't create Unix Socket (24)

I have Googled, and looked on here, and people seem to point to "too many open files". Now, I am unsure as to what exactly this means regarding the connection, as I have php running on a webserver on the same host that connects fine with the MySQL server, and also (for debugging) created a java app to just connect and send back the version number, and that works also. So I don't think it could be that the server is having too many connections.

ulimit settings regarding open files: (-n) 1024

I don't understand why those can connect find to the localhost server, but the c connector can't.

Can someone help?

0 Answers0