Name

mysql_shutdown( )

Synopsis

int mysql_shutdown(MYSQL *mysql)

Use this to shut down the MySQL server. It returns 0 if successful and nonzero if unsuccessful.

...
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 in the example checks if the server is alive. Recall that a zero, not a TRUE, return signifies a live server.

Get MySQL in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.