How do I reconnect to MySQL?
To ensure this, call mysql_options() with the MYSQL_OPT_RECONNECT option: my_bool reconnect = 0; mysql_options(&mysql, MYSQL_OPT_RECONNECT, &reconnect); If the connection has gone down, the effect of mysql_ping() depends on the auto-reconnect state. If auto-reconnect is enabled, mysql_ping() performs a reconnect. How do I reconnect to a MySQL database? To ensure this, call mysql_options() with the MYSQL_OPT_RECONNECT option: my_bool reconnect = 0; …