Name
mysql_create_db( )
Synopsis
mysql_create_db(database
[,connection
])
Use this to
create a database in MySQL for the current connection. The name of
the database to create is given as the first argument of the
function. A different MySQL connection identifier may be given as a
second argument. The function returns true if it’s
successful, false if unsuccessful. This function is deprecated. Use
the mysql_query( )
function with a CREATE
DATABASE
statement instead.
... mysql_create_db('new_db'); $databases = mysql_list_dbs( ); while($db = mysql_fetch_row($databases)) { print $db[0] . "\n"; } ...
This script will create a new database and then display a list of databases to allow the user to confirm that it was successful.
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.