Create MySQL Database
curl -X POST "https://your-dokploy-instance.com/api/mysql.create" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Production MySQL",
"appName": "prod-mysql",
"databaseName": "myapp",
"databaseUser": "appuser",
"databasePassword": "SecurePass123!",
"databaseRootPassword": "RootPass456!",
"dockerImage": "mysql:8",
"environmentId": "env_123456",
"description": "Main production MySQL database"
}'
Display name for the MySQL database
Unique application name used for Docker container identification
Name of the database to create
Username for database access
Password for database user. Must match pattern: ^[a-zA-Z0-9@#%^&*()_+\-=[\]{}|;:,.<>?~]*$`
Root password for MySQL. Must match pattern: ^[a-zA-Z0-9@#%^&*()_+\-=[\]{}|;:,.<>?~]*$`
ID of the environment where this database will be deployed
Docker image to use for MySQL
Optional description of the database instance
Optional server ID for deployment on specific server
Unique identifier for the created MySQL instance
Application name of the database
Display name of the database
Get MySQL Database
curl -X GET "https://your-dokploy-instance.com/api/mysql.one?mysqlId=mysql_123456" \
-H "Authorization: Bearer YOUR_API_TOKEN"
ID of the MySQL database to retrieve
Current status: idle, running, done, or error
External port for database access (if configured)
Deploy MySQL
curl -X POST "https://your-dokploy-instance.com/api/mysql.deploy" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"mysqlId": "mysql_123456"
}'
ID of the MySQL database to deploy
Start MySQL
curl -X POST "https://your-dokploy-instance.com/api/mysql.start" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"mysqlId": "mysql_123456"
}'
ID of the MySQL database to start
Stop MySQL
curl -X POST "https://your-dokploy-instance.com/api/mysql.stop" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"mysqlId": "mysql_123456"
}'
ID of the MySQL database to stop
Update MySQL
curl -X POST "https://your-dokploy-instance.com/api/mysql.update" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"mysqlId": "mysql_123456",
"name": "Updated MySQL Database",
"description": "Updated description",
"memoryLimit": "2g",
"memoryReservation": "1g",
"cpuLimit": "1",
"cpuReservation": "0.5"
}'
ID of the MySQL database to update
Maximum memory (e.g., “2g”, “512m”)
Guaranteed memory allocation
Guaranteed CPU allocation
Save External Port
curl -X POST "https://your-dokploy-instance.com/api/mysql.saveExternalPort" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"mysqlId": "mysql_123456",
"externalPort": 3306
}'
Port number for external access. Set to null to remove external port.
Save Environment Variables
curl -X POST "https://your-dokploy-instance.com/api/mysql.saveEnvironment" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"mysqlId": "mysql_123456",
"env": "MYSQL_MAX_CONNECTIONS=200\nMYSQL_INNODB_BUFFER_POOL_SIZE=256M"
}'
Environment variables in KEY=VALUE format, separated by newlines
Reload MySQL
curl -X POST "https://your-dokploy-instance.com/api/mysql.reload" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"mysqlId": "mysql_123456",
"appName": "prod-mysql"
}'
Application name of the database
Rebuild MySQL
curl -X POST "https://your-dokploy-instance.com/api/mysql.rebuild" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"mysqlId": "mysql_123456"
}'
ID of the MySQL database to rebuild
Remove MySQL
curl -X POST "https://your-dokploy-instance.com/api/mysql.remove" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"mysqlId": "mysql_123456"
}'
ID of the MySQL database to remove
mysql://[databaseUser]:[databasePassword]@[appName]:3306/[databaseName]
Example:
mysql://appuser:SecurePass123!@prod-mysql:3306/myapp
For external connections:
Mount Path
MySQL data is stored at /var/lib/mysql inside the container.