Summary of MySQL API stored procedures available in MySQL for Sitehost and RDC

On this page:


Overview

This information is a quick reference to explain the API stored procedures available in MySQL for Sitehost and RDC. To access a detailed description of each procedure, including a list of parameters and examples, run a statement within MySQL using the following format:

CALL api.help('procedureName');

api.checkDbSize

Summary: Provides the size (in MBs) of all your account schemas.

The procedure only takes into consideration those schemas that contain at least one table; "empty schemas" (that is, schemas with no tables), are ignored.

api.createUserBasic

Summary: Creates schema user and grants it SELECT, INSERT, UPDATE, and DELETE privileges on the specified schemas.

Make sure that you supply the correct name for the schema's suffix. When granting privileges, MySQL does not check for the existence of the schema and will therefore grant privileges to non-existing schemas. If you want to know the privileges that a particular user has, run:

SHOW GRANTS for 'prefix_suffix'@'host';

api.createUserBasic always creates a new user. Do not use this procedure to grant additional read access to an already existing user. When trying to do so you will receive an error (ERROR 1396 (HY000): Operation CREATE USER failed for 'prefix_suffix'@'host').

The password must satisfy the following requirements:

  • It must be at least nine characters in length.
  • It must contain at least two lower and two upper case characters.
  • It must contain at least two numbers.
  • It must contain at least two special characters.
    ‘ ~ ! @ # $ % ^ & * ( ) _ - + = { } [ ] / < > , . ; ? ' : | (space)

api.createUserReadOnly

Summary: Creates schema user and grants it only SELECT (read-only) privileges.

Make sure that you supply the correct name for the schema's suffix. When granting privileges, MySQL does not check for the existence of the schema and will therefore grant privileges to non-existing schemas. To add more privileges or more granularity, use the api.grant procedure.

api.createSchema

Summary: Creates schema following API's naming convention. It automatically takes the prefix of the user calling the procedure and prepends it to the provided suffix parameter.

api.createUser

Summary: Creates schema user. Once the user is created, it is given USAGE privileges, which will basically allow the user to see your schemas, but nothing else.

In order to add privileges to one of your schemas or even granular privileges (for example, rights to a specific column in a specific schema), after creating the user you may use the api.grant() procedure. For a faster/easier way to create common user, you may want to use the createUserReadOnly() or createUserBasic().

The password must satisfy the following requirements:

  • It must be at least nine characters in length.
  • It must contain at least two lower and two upper case characters.
  • It must contain at least two numbers.
  • It must contain at least two special characters.
    ‘ ~ ! @ # $ % ^ & * ( ) _ - + = { } [ ] / < > , . ; ? ' : | (space)

api.dropUser

Summary: Drops user with provided username and host

api.grant

Summary: First revokes all current user privileges and then replaces them with the one(s) provided

You can only grant privileges to already existing users. You can obtain a list of your current users by calling api.listUsers(). Use the procedure api.createUser to add additional users.

If you want to know the privileges that a particular user has, run:

CALL api.showGrants('prefix_suffix', '%');

api.grantExecFunct

Summary: Grants EXECUTE privileges on the provided schema and function name to a single user-host combination.

api.grantExecProc

Summary: Grants EXECUTE privileges on the provided schema and procedure name to a single user-host combination.

api.help

Summary: Displays the help associated with each of the API's procedures. This documentation includes three sections: description, procedure parameters, and examples.

You can also get to this description by running:

CALL api.help('me');

For a list of all procedures ran:

CALL api.listProcedures()

api.listProcedures

Summary: Provides a list of all available API procedures.

api.listUsers

Summary: Provides a list of all your account users; that is, all users with the same prefix (first part of the username).

api.revoke

Summary: Procedure revokes specified privileges of the provided user.

api.revokeExecFunct

Summary: Revokes EXECUTE privileges on provided schema and function name to a single user-host combination.

Execute privileges must be revoked one procedure at a time; using * for all available procedures will result in an error.

api.revokeExecProc

Summary: Revokes EXECUTE privileges on provided schema and procedure name to a single user-host combination.

Execute privileges must be revoked one procedure at a time; using * for all available procedures will result in an error.

api.setPassword

Summary: Sets the password for provided user-host combination.

The password must satisfy the following requirements:

  • It must be at least nine characters in length.
  • It must contain at least two lower and two upper case characters.
  • It must contain at least two numbers.
  • It must contain at least two special characters.
    ‘ ~ ! @ # $ % ^ & * ( ) _ - + = { } [ ] / < > , . ; ? ' : | (space)

api.showGrants

Summary: Shows the grants for provided username and host combination.

To obtain a list of all your users, use the api.listusers() procedure. For more information, run:

CALL api.help('listUsers');