Create a MySQL database with a MySQL user
POST /v2/ projects/ {projectId}/ mysql-databases/
v2
POST
database-create-mysql-database
Request
Responses
Usage examples
- cURL
- JavaScript SDK
- PHP SDK
$ curl \
--fail \
--location \
-X POST \
-d '{"database":{"characterSettings":{"characterSet":"string","collation":"string"},"description":"string","projectId":"f0f86186-0a5a-45b2-aa33-502777496347","version":"string"},"user":{"accessIpMask":"string","accessLevel":"full","externalAccess":true,"password":"string"}}' \
-H "Authorization: Bearer $MITTWALD_API_TOKEN" \
-H 'Content-Type: application/json' \
https://api.mittwald.de/v2/projects/f0f86186-0a5a-45b2-aa33-502777496347/mysql-databases
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.createMysqlDatabase({
"projectId": "f0f86186-0a5a-45b2-aa33-502777496347",
"data": {
"database": {
"characterSettings": {
"characterSet": "string",
"collation": "string"
},
"description": "string",
"projectId": "f0f86186-0a5a-45b2-aa33-502777496347",
"version": "string"
},
"user": {
"accessIpMask": "string",
"accessLevel": "full",
"externalAccess": true,
"password": "string"
}
}
});
assertStatus(response, 201);
use \Mittwald\ApiClient\Generated\V2\Clients\Database\CreateMysqlDatabase\CreateMysqlDatabaseRequest;
use \Mittwald\ApiClient\Generated\V2\Clients\Database\CreateMysqlDatabase\CreateMysqlDatabaseRequestBody;
$client = MittwaldAPIClient::newWithToken(getenv('MITTWALD_API_TOKEN'));
// TODO: Please consult the properties and constructor signature of
// CreateMysqlDatabaseRequestBody to learn how to construct a valid instance
$body = new CreateMysqlDatabaseRequestBody(/* TODO: ... */);
$request = (new CreateMysqlDatabaseRequest(
projectId: "f0f86186-0a5a-45b2-aa33-502777496347",
body: $body
));
$response = $client->database()->createMysqlDatabase($request);
var_dump($response->getBody();