Skip to main content

Create a MySQL user

POST/v2/mysql-databases/{mysqlDatabaseId}/users
API version
v2
Request method
POST
Operation ID
database-create-mysql-user

Request​

  • mysqlDatabaseIdstringrequired

    ID of the MySQLDatabase to create a MySQLUser for.

Responses​

Format
application/json
Description

Created

  • idstring (uuid)required
Content-Type: application/json

{
"id": "f0f86186-0a5a-45b2-aa33-502777496347"
}
{
"properties": {
"id": {
"format": "uuid",
"type": "string"
}
},
"required": [
"id"
],
"type": "object"
}

Usage examples​

$ curl \
--fail \
--location \
-X POST \
-d '{"accessLevel":"full","databaseId":"f0f86186-0a5a-45b2-aa33-502777496347","description":"string","externalAccess":true,"password":"string"}' \
-H "Authorization: Bearer $MITTWALD_API_TOKEN" \
-H 'Content-Type: application/json' \
https://api.mittwald.de/v2/mysql-databases/string/users
import { MittwaldAPIV2Client } from "@mittwald/api-client";
import { assertStatus } from "@mittwald/api-client-commons";

const client = MittwaldAPIClient.newWithToken(process.env.MITTWALD_API_TOKEN);
const response = await client.database.createMysqlUser({
"mysqlDatabaseId": "string",
"data": {
"accessLevel": "full",
"databaseId": "f0f86186-0a5a-45b2-aa33-502777496347",
"description": "string",
"externalAccess": true,
"password": "string"
}
});

assertStatus(response, 201);

use \Mittwald\ApiClient\Generated\V2\Clients\Database\CreateMysqlUser\CreateMysqlUserRequest;
use \Mittwald\ApiClient\Generated\V2\Clients\Database\CreateMysqlUser\CreateMysqlUserRequestBody;

$client = MittwaldAPIClient::newWithToken(getenv('MITTWALD_API_TOKEN'));

// TODO: Please consult the properties and constructor signature of
// CreateMysqlUserRequestBody to learn how to construct a valid instance
$body = new CreateMysqlUserRequestBody(/* TODO: ... */);

$request = (new CreateMysqlUserRequest(
mysqlDatabaseId: "string",
body: $body
));
$response = $client->database()->createMysqlUser($request);

var_dump($response->getBody();

On this page