Child pages
  • cPanel API 1 Functions - Mysql::adddb

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

 

Description

Excerpt

This function creates a MySQL® database.

Warning
titleWarning:

Include Page
LIB:_cPanelAPI1NewerFunctions
LIB:_cPanelAPI1NewerFunctions

  • UAPI (recommended)Mysql::create_database
    Excerpt Include
    UAPI Functions - Mysql::create_database
    UAPI Functions - Mysql::create_database
    nopaneltrue
  • cPanel API 2MysqlFE::createdb
    Excerpt Include
    cPanel API 2 Functions - MysqlFE::createdb
    cPanel API 2 Functions - MysqlFE::createdb
    nopaneltrue
Panel
bgColor#F2F2F2
borderStylenone

Examples


Panel
bgColor#FFFFFF
borderStylenone
Expand
titleLiveAPI PHP Class
Code Block
languagephp
linenumberstrue
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
$add_db = $cpanel->api1('Mysql','adddb', array('database') ); // Call the function.

Include Page
LIB:_LiveAPIPHPLink
LIB:_LiveAPIPHPLink

Expand
titleLiveAPI Perl Module
Code Block
languageperl
linenumberstrue
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
my $add_db = $cpliveapi->api1('Mysql','adddb', ['database'] ); # Call the function.

Include Page
LIB:_LiveAPIPerlLink
LIB:_LiveAPIPerlLink

Expand
titlecPanel Tag System (deprecated)

Include Page
LIB:_cPanelTagsWarning
LIB:_cPanelTagsWarning

Code Block
languagetext
<cpanel Module="Mysql::adddb( $FORM('dbname'))">
Expand
titleCommand Line
Code Block
languagebash
cpapi1 --user=username Mysql adddb database

Include Page
LIB:_cPanelAPI1CLINote
LIB:_cPanelAPI1CLINote

Expand
titleOutput (none)
This function does not return output.

Parameters

ParameterTypeDescriptionPossible valuesExample
dbnamestring

Required

The MySQL database name.

A valid database name.

If database prefixing is enabled and this parameter does not begin with the prefix, the function will automatically add it.

Warning
titleWarning

The maximum length of the database name is 64 characters. However, due to the method that cPanel & WHM uses to store MySQL database names, each underscore character requires two characters of that limit. Therefore, if you enable database prefixing, the maximum length of the database name is 63 characters, which includes both the database prefix and the underscore character. Each additional underscore requires another two characters of that limit.

If the total length of the username is longer than the character limit for database usernames, the function will fail.

database

Returns

This function does not return output.