cPanel API 1 Functions - Mysql::adduser

Description

This function creates a MySQL® database user.

Warning:

cPanel API 1 is deprecatedDo not use this function. Instead, we strongly recommend that you use the following newer functions:

Examples


 LiveAPI PHP Class

$cpanel new CPANEL(); // Connect to cPanel - only do this once.
$add_mysqluser $cpanel->api1('Mysql','adduser'array('user','12345luggage') ); // Call the function.

 LiveAPI Perl Module

my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
my $add_mysqluser $cpliveapi->api1('Mysql','adduser', ['user','12345luggage'] ); # Call the function.

 cPanel Tag System (deprecated)

Warning:

In cPanel & WHM version 11.30 and later, cPanel tags are deprecated. This example is present in order to help developers move from the old cPanel tag system to our LiveAPI.

We strongly recommend that you only use the LiveAPI system to call the cPanel APIs.

 

<cpanel Module="Mysql::adduser($FORM('username','password'))">

 Command Line

cpapi1 --user=username Mysql adduser username=user password=12345luggage

 

Notes:

  • You must URI-encode these values.
  • username represents your account-level username.

 Output (none)

This function does not return output.

Parameters

 Parameter 

 Type 

Description

Possible values

Example

 username

 string 

 Required

 The MySQL user's name.

  • If database prefixing is enabled, this will be the cPanel account name, an underscore, and the username
  • If database prefixing is disabled, this will be only the username.

 Important:

 To learn more about database username limits, click the database type to expand the following:

 MySQL

MySQL limits the database username to 16 characters. The system includes the database prefix (the first eight characters of the cPanel account's username and an underscore character) in the character count for the username.

For example:

  • A MySQL database with the db_ prefix allows usernames up to 13 characters long.
  • A MySQL database with the example_ prefix allows usernames up to eight characters long.

 MariaDB

 MariaDB limits the database username to 47 characters. The system includes the database prefix (all of the cPanel account's username and an underscore character) in the character count for the username.

 For example:

  • A MariaDB database with the db_ prefix allows usernames up to 44 characters long.
  • A MariaDB database with the example_ prefix allows usernames up to 39 characters long.

 

 user

 password

 string 

 Required

 The MySQL user's password. 

 A secure password.

 12345luggage 

 

Returns

This function does not return output.

  • 6 Users Found This Useful
Was this answer helpful?

Related Articles

The cPanel Interface

For  cPanel  &  WHM  version  58 Overview The cPanel interface is...

User Preferences

For cPanel & WHM version 58 Overview This document outlines how to access your cPanel...

Manage External Authentications

For cPanel & WHM version 58 Overview Manage credentials Additional documentation...

What is cPanelID?

In This Article:  Overview ServicesHow to get a cPanelID cPanelID External...

Guide to cPanel Interface Customization - cPanel Style Development

Introduction You can develop custom styles that modify the appearance of the cPanel interface....