Child pages
  • WHM API 1 Functions - list_mysql_databases_and_users

Versions Compared

Key

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

Description

Excerpt

This function retrieves the MySQL® database and user data for the specified account.

Multiexcerpt include
SpaceWithExcerptcom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@12665
MultiExcerptNameAPIDisabledMySQLRole
PageWithExcerptLIB:_ServerRoleDisabledAPI

Panel
bgColor#F2F2F2
borderStylenone

Examples 


Panel
bgColor#FFFFFF
borderStylenone


Expand
titleJSON API


Code Block
languagexml
https://hostname.example.com:2087/cpsess##########/json-api/list_mysql_databases_and_users?api.version=1&user=user1



Expand
titleXML API


Code Block
languagexml
https://hostname.example.com:2087/cpsess##########/xml-api/list_mysql_databases_and_users?api.version=1&user=user1



Expand
titleCommand Line


Code Block
whmapi1 list_mysql_databases_and_users user=user1

Include Page
LIB:_WHMAPI1CLINote
LIB:_WHMAPI1CLINote


Expand
titleOutput (JSON)


Code Block
languagetext
linenumberstrue
{  
   "data":{  
      "mysql_databases":{  
         "user1_database1":[  
            "user1_user5"
         ]
      },
      "mysql_config":{  
         "use_db_prefix":"1",
         "prefix_length":8,
         "mysql-version":"5.5"
      }
   },
   "metadata":{  
      "reason":"OK",
      "version":1,
      "command":"list_mysql_databases_and_users",
      "result":1
   }
}



Expand
titleOutput (XML)


Code Block
languagetext
linenumberstrue
<result>
    <metadata>
        <reason>OK</reason>
        <version>1</version>
        <result>1</result>
        <command>list_mysql_databases_and_users</command>
    </metadata>
    <data>
        <mysql_config>
            <use_db_prefix>1</use_db_prefix>
            <mysql-version>5.5</mysql-version>
            <prefix_length>8</prefix_length>
        </mysql_config>
        <mysql_databases>
            <user1_database1>user1_user5</user1_database1>
        </mysql_databases>
    </data>
</result>


Include Page
LIB:_WHMAPIShellNote
LIB:_WHMAPIShellNote


Parameters

ParameterTypeDescriptionPossible valuesExample
userstring

Required

The username for a specified account.

A valid string.user1

Returns

Return

TypeDescriptionPossible valuesExample

mysql_config

hash

A hash of the user's MySQL database configuration settings.

This hash includes the user_db_prefix, mysql-version, and prefix_length returns.

 

use_db_prefix

Boolean

Whether database prefixing is enabled on the server.

The function returns this value in the mysql_config hash.

  • 1 — Enabled.
  • 0 — Disabled.
1

mysql-version

integer

The MySQL version installed on the server.

The function returns this value in the mysql_config hash.

A positive integer.

5.5

prefix_length

integer

The maximum number of characters allowed for the prefix on this server.

The function returns this value in the mysql_config hash.

8 or 16, dependent upon the installed version of MySQL.8

mysql_databases

hash

A hash of database names and users.

This hash includes the database_user return. 

database_user

array

A list of database users.

The function returns this value in the mysql_databases hash.

Note
titleNote:

The return's name is the MySQL database's name.


A comma-separated list of database users.
user1_user5