mysql_shutdown()
int mysql_shutdown(MYSQL *mysql)
Use this function to shut down the MySQL server. It returns zero if successful, and a nonzero value if not. Here is an example:
...
if(!mysql_ping(mysql))
{
mysql_shutdown(mysql);
printf("Shutting down server \n");
if(mysql_ping(mysql))
{ printf("MySQL server is down.\n"); }
}
...The mysql_ping() function here checks
whether the server is alive. Recall that a zero, not a
TRUE, return signifies a live server.