Hi, I have just tried your routine, I use something very similar, (I have changed the "localhost" to 127.0.0.1 so it will not use the pipeline) but I am still expiriencing the same exact problem, weather reconnect is set or not, the error remains the same. That is what got me wondering in the first place.
--- (MySQL shutdown) Begin Failed to connect to database: Error: Can't connect to MySQL server on '127.0.0.1' (60) (MySQL startup with mysql.reconnect = 1/0) Error: MySQL server has gone away --- This is always what I am getting. Does reconnect work right for you? Regards, Lefteris Gleb Paharenko wrote:
Hello. In my opinion it depends on the value of reconnect flag (the part of MYSQL structure). I've written a simple program which connects to MySQL server, waits a bit and executes mysql_ping. While it is waiting, MySQL server is being restarted. If mysql.reconnect = 1, mysql_ping() returns success, otherwise we have "Server has gone away". Here is the test program: #include<stdio.h> #include<mysql/mysql.h> int main() { MYSQL mysql; char c; printf("Begin\n"); mysql_init(&mysql); mysql_options(&mysql,MYSQL_READ_DEFAULT_GROUP,"mysql"); if (!mysql_real_connect(&mysql,"localhost" ,"root" ,"" ,"test" ,0 ,NULL ,0)) { fprintf(stderr, "Failed to connect to database: Error: %s\n", mysql_error(&mysql)); } mysql.reconnect = 0; c=getchar(); if( mysql_ping(&mysql) != 0) { printf("Error: %s", mysql_error(&mysql)); } else { printf("Ok!\n"); } } Lefteris Tsintjelis wrote:Hi, Is mysql_ping () suppose to restore a db connection even after a db restart? Thnx, Lefteris
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
