Heey,
Can somebody help me out?
I'm working on a simple c program that has to connect to my database, then do a query and then close the connection.
int main()
{
MYSQL *conn;
conn = mysql_init(NULL);
if (conn == NULL) {
printf("Error %u %s\n", mysql_errno(conn), mysql_error(conn));
exit(1);
}
if (mysql_real_connect(conn, "localhost", "root", "root", NULL, 8889, NULL, 0)) {
printf("Error %u: %s\n", mysql_errno(conn), mysql_error(conn));
exit(1);
}
if (mysql_query(conn, "create database testdb")) {
printf("Error %u: %s",mysql_errno(conn), mysql_error(conn));
exit(1);
}
mysql_close(conn);
return 0;
}
This code compiles but when i run it, it will exit after the mysql_query() statement.
The following error is returned:
Error 2006: MySQL server has gone away
I used google to search for an awnser and ended up here:
http://dev.mysql.com/doc/refman/5.0/en/gone-away.html
This couldn't help me find the solution.
Thanks alot.