You can call the mysql_create_db() function to create a database named by db.
Syntax
int
mysql_create_db(MYSQL *mysql,
const char *db)
Return values
0 is returned for a creation success, and a non-zero value is returned if an error occurred.
Error
CR_COMMANDS_OUT_OF_SYNC: Commands were executed in an improper order.CR_SERVER_GONE_ERROR: The connection to the OBServer was disconnected.CR_SERVER_LOST: The connection to the server was lost during the query.CR_UNKNOWN_ERROR: An unknown error occurred.
Notes
This function is deprecated. Use mysql_real_query() or mysql_query() to issue an SQL CREATE DATABASE statement instead.