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

Versions Compared

Key

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

Description

Excerpt

This function grants permissions to a MySQL® database user.


Warning
titleWarning:

Include Page
LIB:_cPanelAPI1NewerFunctions
LIB:_cPanelAPI1NewerFunctions


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_perms = $cpanel->api1('Mysql','adduserdb', array('database','username','alter lock create') ); // 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_perms = $cpliveapi->api1('Mysql','adduserdb', ['database','username','alter lock create'] ); # 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::adduserdb( $FORM('dbname','user','perms_list'))">



Expand
titleCommand Line


Code Block
languagebash
cpapi1 --user=username Mysql adduserdb database user "alter lock create"

Include Page
LIB:_cPanelAPI1CLINote
LIB:_cPanelAPI1CLINote


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



Parameters

ParameterTypeDescriptionPossible valuesExample
dbnamestring

Required

The MySQL database name.

A valid MySQL database.

Include Page
LIB:_MySQL Username Limit
LIB:_MySQL Username Limit

database
usernamestring

Required

The MySQL user's name.

A valid MySQL user.user
perms_liststring

Required

The permissions to grant to the MySQL user.

Use any of the following values in a space-delimited list:
  • alter — ALTER
  • temporary CREATE TEMPORARY TABLES
  • routine CREATE ROUTINE
  • create CREATE
  • delete DELETE
  • drop DROP
  • select SELECT
  • insert INSERT
  • update UPDATE
  • references REFERENCES
  • index INDEX
  • lock LOCK TABLES
  • all ALL
alter lock create

Returns

This function does not return output.