.pdf)
WHM Plugins
| API Version: | 1 - Click here for documentation |
|---|---|
| Syntax: | Mysql::number_of_dbs( ) |
| Description: | Retrieve the number of database users an account has created. |
| Returns: | |
An integer indicating the number of MySQL users associated with the current account. |
| API Version: | 1 - Click here for documentation |
|---|---|
| Syntax: | Mysql::checkdb( dbname ) |
| Description: | Run a MySQL database check. |
| Parameters: | |
| dbname (string) | |
| The name of the MySQL database to check. | |
| Returns: | |
Nothing
|
| API Version: | 1 - Click here for documentation |
|---|---|
| Syntax: | Mysql::deluser( dbuser ) |
| Description: | Remove a user from MySQL. |
| Parameters: | |
| dbuser (string) | |
| The name of the MySQL user to remove. This valued must be prefixed with the cPanel username (e.g., cpuser_dbuser). | |
| Returns: | |
Nothing
|
| API Version: | 1 - Click here for documentation |
|---|---|
| Syntax: | Mysql::addhost( hostname ) |
| Description: | Authorize a remote host to access a cPanel account's MySQL users. |
| Parameters: | |
| hostname (string) | |
| The IP address or hostname that should be provided access. | |
| Returns: | |
Nothing
|
| API Version: | 1 - Click here for documentation |
|---|---|
| Syntax: | Mysql::updateprivs( ) |
| Description: | Force an update of MySQL privileges and passwords. |
| Returns: | |
Nothing
|
| API Version: | 1 - Click here for documentation |
|---|---|
| Syntax: | Mysql::adduser( username, password ) |
| Description: | Create a new MySQL user. |
| Parameters: | |
| username (string) | |
| The MySQL user to create.
If database_prefix = 0 in the cpanel.config file, then the cPanel account's username will not automatically be prepended to the new MySQL username.
However, if database_prefix = 1 or the value is missing, then the username will be prepended. (For example, if you enter username then the output would be in cpuser_username.) |
|
| password (string) | |
| The password for the new MySQL user. | |
| Returns: | |
None
|
| API Version: | 1 - Click here for documentation |
|---|---|
| Syntax: | Mysql::repairdb( dbname ) |
| Description: | Run a MySQL database repair. |
| Parameters: | |
| dbname (string) | |
| The name of the MySQL database to repair. | |
| Returns: | |
Nothing
|
| API Version: | 1 - Click here for documentation |
|---|---|
| Syntax: | Mysql::deluserdb( dbname, dbuser ) |
| Description: | Disallow a MySQL user from accessing a database. |
| Parameters: | |
| dbname (string) | |
| The MySQL database from which to remove the user's permissions. | |
| dbuser (string) | |
| The name of the MySQL user to remove. | |
| Returns: | |
Nothing
|
| API Version: | 1 - Click here for documentation |
|---|---|
| Syntax: | Mysql::deldb( dbname ) |
| Description: | Remove a database from MySQL. |
| Parameters: | |
| dbname (string) | |
| The name of the database to remove from MySQL. This value must be prefixed with the cPanel username (e.g., cpuser_dbname). | |
| Returns: | |
Nothing
|
| API Version: | 1 - Click here for documentation |
|---|---|
| Syntax: | Mysql::adduserdb( dbname, dbuser, perms_list ) |
| Description: | Grant a user permission to access a database within a cPanel account. |
| Parameters: | |
| dbname (string) | |
| The name of the database to allow the user to access. | |
| dbuser (string) | |
| The MySQL user who should be given access to the database. | |
| perms_list (string) | |
| A space-separated list of permissions to grant to the user (e.g., "all" or "alter drop create delete insert update lock" ). Possible values with corresponding MySQL permissions are as follows: 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 . |
|
| Returns: | |
Nothing |
| API Version: | 1 - Click here for documentation |
|---|---|
| Syntax: | Mysql::initcache( ) |
| Description: | Refresh the cache of MySQL information. This includes users, databases, routines and other related information. |
| Returns: | |
Nothing.
|
| API Version: | 1 - Click here for documentation |
|---|---|
| Syntax: | Mysql::adddb( dbname ) |
| Description: | Add a new MySQL database to a cPanel account. |
| Parameters: | |
| dbname (string) | |
| The name of the MySQL database to add.
The name of the MySQL database to add.
If database_prefix = 0 in the cpanel.config file, then the cPanel account's username will not automatically be prepended to the name of the database.
However, if database_prefix = 1 or the value is missing, then the username will be prepended. (For example, if you enter dbname then the output would be in cpuser_dbname) |
|
| Returns: | |
Nothing
|
| API Version: | 1 - Click here for documentation |
|---|---|
| Syntax: | Mysql::listusersopt( ) |
| Description: | Generate a chunk of HTML for managing the MySOL users within cPanel. This function will list the users inside of |
| Returns: | |
<option value="cpuser_dbuser">cpuser_dbuser</option> <option value="cpuser_dbuser2">cpuser_dbuser2</option> |
| API Version: | 1 - Click here for documentation |
|---|---|
| Syntax: | Mysql::delhost( host ) |
| Description: | Remove host access permissions from MySQL. |
| Parameters: | |
| host (string) | |
| The IP address of the host whose access should be revoked. | |
| Returns: | |
Nothing
|
| API Version: | 1 - Click here for documentation |
|---|---|
| Syntax: | Mysql::listdbs( ) |
| Description: | Generate a chunk of HTML that lists the databases for a specific page. We recommend using MysqlFE::listdbs rather than this function. |
| Returns: | |
<b>cpuser_db</b><a href="deldb.html?db=cpuser_db"><img src="/frontend/x3/images/delete.jpg" border="0" alt="" /></a><a href="checkdb.html?db=cpuser_db"><img src="/frontend/x3/images/mysqlcheck.gif" border="0" alt="" /></a><a href="repairdb.html?db=cpuser_db"><img src="/frontend/x3/images/mysqlrepair.gif" border="0" alt="" /></a><blockquote><u>Users in db</u><br /> cpuser_dbuser (Privileges: SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, CREATE ROUTINE) <a href="deluserfromdb.html?db=cpuser_db&user=cpuser_dbuser"><img src="/frontend/x3/images/delete.jpg" border=0></a> <br /> <blockquote> <table> <tr> <td colspan=2><b>Connection Strings</b></td> </tr> <tr> <td><b>Perl</b></td> <td><i><font size=-1>$dbh = DBI->connect("DBI:mysql:cpuser_db:localhost",<br />"cpuser_dbuser","<PASSWORD HERE>");</i></font></td> </tr> <tr> <td><b>PHP</b></td> <td><i><font size=-1>$dbh=mysql_connect ("localhost", "cpuser_dbuser",<br />"<PASSWORD HERE>") or die('Cannot connect to the database because: ' . mysql_error());<br />mysql_select_db ("cpuser_db");</font></i></td> </tr> </table> </blockquote> </blockquote><br /><b>cpuser_db2</b><a href="deldb.html?db=cpuser_db2"><img src="/frontend/x3/images/delete.jpg" border="0" alt="" /></a><a href="checkdb.html?db=cpuser_db2"><img src="/frontend/x3/images/mysqlcheck.gif" border="0" alt="" /></a><a href="repairdb.html?db=cpuser_db2"><img src="/frontend/x3/images/mysqlrepair.gif" border="0" alt="" /></a></blockquote><br /> |
| API Version: | 1 - Click here for documentation |
|---|---|
| Syntax: | Mysql::routines( ) |
| Description: | List MySQL routines created by a user. |
| Returns: | |
This function returns HTML similar to: If <span class=\"status\">USERNAME</span> is deleted then these routines will be unusable: <span class=\"status\">routine1, routine2</span><br/>" |
| API Version: | 1 - Click here for documentation |
|---|---|
| Syntax: | Mysql::gethost( ) |
| Description: | Get the address of the MySQL host that is used by the server. |
| Returns: | |
The IP or hostname of the MySQL host being used.
|
| API Version: | 1 - Click here for documentation |
|---|---|
| Syntax: | Mysql::number_of_dbs( ) |
| Description: | Retrieve the number of databases currently in use. |
| Returns: | |
An integer indicating the number of databases in use by a user.
|
| API Version: | 1 - Click here for documentation |
|---|---|
| Syntax: | Mysql::listdbsopt( ) |
| Description: | Generate a list of databases associated with a cPanel account, encapsulated in >option< HTML tags. We recommend using MysqlFE::listdbs rather than this function. |
| Returns: | |
<option value="cpuser_db">cpuser_db</option> <option value="cpuser_db2">cpuser_db2</option> |
| API Version: | 1 - Click here for documentation |
|---|---|
| Syntax: | Mysql::listusers( ) |
| Description: | Generate a chunk of HTML for managing MySQL users. We recommend using MysqlFE::listusers rather than this function. |
| Returns: | |
cptest_dbuser <a href="deluser.html?user=cptest_dbuser"><img src="/frontend/x3/images/delete.jpg" border="0" alt="" /></a><br /> cptest_dbuser2 <a href="deluser.html?user=cptest_dbuser2"><img src="/frontend/x3/images/delete.jpg" border="0" alt="" /></a><br /> |