mysql_create_db

bool mysql_create_db(string database_name, [mysql link connection]) 
database_name Name for the new database
connection Connection handle returned by mysql_connect() or mysql_pconnect()

Creates a new database.

Returns:

TRUE on success; FALSE on failure

Description:

mysql_create_db() creates a new MySQL database named database_name , on the server specified by connection .

Caution:

It is often easier and more secure to create databases via a MySQL client as a privileged user.

Version:

PHP 3+, PHP 4+

See also:

To drop (delete) a database:

mysql_drop_db() 

Example:

Create a new database on the default MySQL server
 <?php // Connect to the default MySQL server $mysql_link = mysql_connect () or die ("Could not connect to the ...

Get PHP Functions Essential Reference 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.