Description

This function creates a MySQL® database user.

Examples




https://hostname.example.com:2083/cpsess##########/execute/Mysql/create_user?name=dbuser&password=12345luggage



$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Create a new database user.
$create_db_user = $cpanel->uapi(
    'Mysql', 'create_user',
    array(
        'name'       => 'dbuser',
        'password'   => '12345luggage',
    )
);



my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Create a new database user.
my $create_db_user = $cpliveapi->uapi(
    'Mysql', 'create_user',
    {
        'name'       => 'dbuser',
        'password'   => '12345luggage',
    }
);



<!-- Create a new user. -->
[% execute( 'Mysql', 'create_user', { name => 'dbuser', password => '12345luggage' } ) %]



uapi --user=username Mysql create_user name=dbuser password=12345luggage



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

   },
   "data":null
} 



Parameters

ParameterTypeDescriptionPossible valuesExample
namestring

Required

The new user's name.

A valid database username.

dbuser
passwordstring

Required

The new user's password.

A secure password that meets the server's minimum MySQL password strength requirements.

12345luggage

Returns

This function only returns metadata.