Table of Contents

Syntax

bool mysql_create_db(string $dbname [, resource $res])

(PHP 4, PHP 5)

$dbname The name of the database you wish to create.
$res The database connection resource that we want to use.
RETURNS Detailed information about the last query.

What it Does

Attempts to create a new database on the MySQL server using the provided database name ($dbname). In order to succeed, the MySQL user you used to connect to the database must have DBA permissions on the server. The optional database resource ($res) parameter is used to indicate a specific connection to use.

Example

// open the mysql resource
$res = mysql_connect($server, $user, $pass);
 
// get the error number
$minfo = mysql_create_db('mynewdb', $res);