cPanel API 1 Functions - Mysql::adduserdb

Description

This function grants permissions to 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_perms $cpanel->api1('Mysql','adduserdb'array('database','username','alter lock create') ); // Call the function.

 LiveAPI Perl Module

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.

 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::adduserdb( $FORM('dbname','user','perms_list'))">


 Output (HTML)

This function does not return output.

Parameters

 Parameter 

 Type 

Description

Possible values

Example

 dbname

 string 

 Required

 The MySQL database name.

 A valid MySQL database.

 

 Important:

 To learn more about database username limits, click your 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.

 

 database

 username

 string

 Required

 The MySQL user's name.

 A valid MySQL user.

 user

 perms_list

 string

 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.

  • 10 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....