Name

mysql_drop_db( )

Synopsis

int mysql_drop_db(MYSQL *mysql, const char *database)

Use this to delete the database named in the second argument of the function from the MySQL server. It returns 0 if successful and nonzero if not. This function has been deprecated. Use mysql_query( ) or mysql_real_query( ) with a DROP DATABASE statement instead.

...
mysql = mysql_init(NULL);
mysql_real_connect(mysql,host,user,password,NULL,0,NULL,0);
...
mysql_drop_db(mysql, "db5");
...

This returns a nonzero if it fails, so a program that uses it should include error checking for the function. Otherwise, the program may hang if the function is unsuccessful.

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.