Currently, the Database and User API is only supported by mysql datastore. For
others, the recommended way is to get root password
(POST /v1.0/{project_id}/instances/{instance_id}/root
) and communicate with
the database service directly for database and user management.
.. rest_method:: POST /v1.0/{project_id}/instances/{instanceId}/databases
Creates a database within an instance.
Normal response codes: 202
.. rest_parameters:: parameters.yaml - project_id: project_id - instanceId: instanceId - name: name - characterSet: characterSet - collate: collate
.. literalinclude:: samples/databases-create-request.json :language: javascript
.. rest_method:: GET /v1.0/{project_id}/instances/{instanceId}/databases
Lists databases for an instance.
This operation returns only the user-defined databases and not the system
databases. Only the database administrator can get system databases such as
mysql
, information_schema
, and lost+found
.
Normal response codes: 200
.. rest_parameters:: parameters.yaml - project_id: project_id - instanceId: instanceId
.. literalinclude:: samples/databases-list-response.json :language: javascript
.. rest_method:: GET /v1.0/{project_id}/instances/{instanceId}/users/{user_name}/databases
Get all the databases that the user has access to.
Normal response codes: 200
.. rest_parameters:: parameters.yaml - project_id: project_id - instanceId: instanceId - user_name: user_name
.. literalinclude:: samples/databases-list-response.json :language: javascript
.. rest_method:: PUT /v1.0/{project_id}/instances/{instanceId}/users/{user_name}/databases
Grant user access to the databases.
Normal response codes: 202
.. rest_parameters:: parameters.yaml - project_id: project_id - instanceId: instanceId - user_name: user_name
.. literalinclude:: samples/user-grant-databases-access-request.json :language: javascript
.. rest_method:: DELETE /v1.0/{project_id}/instances/{instanceId}/users/{user_name}/databases/{database_name}
Revoke user access to the database.
Normal response codes: 202
.. rest_parameters:: parameters.yaml - project_id: project_id - instanceId: instanceId - user_name: user_name - database_name: databaseName
.. rest_method:: DELETE /v1.0/{project_id}/instances/{instanceId}/databases/{database_name}
Deletes a database.
Normal response codes: 202
.. rest_parameters:: parameters.yaml - project_id: project_id - instanceId: instanceId - database_name: databaseName