Description
This function creates a MySQL® database.
Warning:
- UAPI (recommended) —
Mysql::create_database
— This function creates a MySQL® database. - cPanel API 2 —
MysqlFE::createdb
— This function creates a database.
Examples
Parameters
Parameter |
Type |
Description |
Possible values |
Example |
dbname |
string |
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 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 requirestwo 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.