Description

This function creates a MySQL® database.

Examples 




https://hostname.example.com:2083/cpsess##########/execute/Mysql/create_database?name=newdb



$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Create a new database.
$create_db = $cpanel->uapi(
    'Mysql', 'create_database',
    array(
        'name'    => 'newdb',
    )
);



my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Create a new database.
my $create_db = $cpliveapi->uapi(
    'Mysql', 'create_database',
    {
        'name'    => 'newdb',
    }
);



<!-- Create a new database. -->
[% execute( 'Mysql', 'create_database', { name => 'newdb' } ) %]



uapi --user=username Mysql create_database name=newdb



{  
   "messages":null,
   "errors":null,
   "status":1,
   "metadata":{  

   },
   "data":null
} 



Parameters

ParameterTypeDescriptionPossible valuesExample
namestring

Required

The new database's name.

A valid database name.

If database prefixing is enabled, you must prefix this value with the account prefix and an underscore (_).

For example, to create the newdb database on the user cPanel account, pass a value of user_newdb


newdb

Returns

This function only returns metadata.