MySQL / MariaDB¶
Overview¶
StarkOne provides full MySQL/MariaDB management: database creation, user management, import/export, phpMyAdmin integration, performance tuning, and replication.
All database endpoints require at minimum websites_management. Admin-level MySQL operations (tuner, replication, restart) require administrative_operations.
Database Operations¶
List Databases for a Website¶
Create a Database¶
POST /api/databases
{
"username": "example",
"db_name": "example_wp",
"db_user": "example_wpuser",
"db_password": "secret"
}
Delete a Database¶
Duplicate a Database¶
Import a Database¶
Export a Database¶
Database Users¶
Create User¶
POST /api/databases/:id/users
{
"username": "extra_user",
"password": "secret",
"host": "localhost"
}
Reset User Password¶
Delete User¶
MySQL Dashboard¶
Global MySQL admin panel - requires administrative_operations:
# Service status
GET /api/mysql/status
# Running processes
GET /api/mysql/processes
# Kill a process
POST /api/mysql/processes/:id/kill
# Kill all user processes
POST /api/mysql/processes/kill-all
# Slow query log
GET /api/mysql/slow-log
# Real-time monitor stats
GET /api/mysql/monitor-stats
# Restart / stop / (re)install
POST /api/mysql/restart
POST /api/mysql/stop
POST /api/mysql/install
Remote Access¶
Port¶
Max Connections¶
Read-Only Mode¶
phpMyAdmin¶
StarkOne can install phpMyAdmin and provide single-click login:
# Status
GET /api/mysql/phpmyadmin
# Install
POST /api/mysql/phpmyadmin/install
# Update
POST /api/mysql/phpmyadmin/update
# Get auto-login URL
POST /api/mysql/phpmyadmin/login
MySQL Optimizer (Tuner)¶
Runs MySQLTuner to analyse and apply performance recommendations:
# Run tuner analysis
GET /api/mysql/tuner
# Install MySQLTuner
POST /api/mysql/tuner/install
# Apply recommended settings
POST /api/mysql/tuner/apply
{ "recommendations": ["max_connections=300", "innodb_buffer_pool_size=512M"] }
MySQL Replication¶
StarkOne supports master-slave MySQL replication setup via the panel.
# Get replication status
GET /api/mysql/replication
# Initialise replication (configure master binlog)
POST /api/mysql/replication/init
# Connect slave to master
POST /api/mysql/replication/connect
{
"master_host": "10.0.0.1",
"master_user": "replication",
"master_password": "secret"
}
# Start slave replication
POST /api/mysql/replication/start
# Initial data sync (copies all DBs from master to slave)
POST /api/mysql/replication/sync
# SSE stream for sync progress
GET /api/mysql/replication/sync-stream
# List replication slaves
GET /api/mysql/replication/slaves
# Add slave
POST /api/mysql/replication/slaves
{ "host": "10.0.0.2", "port": 3306 }
# Remove slave
DELETE /api/mysql/replication/slaves/:id
# Remove replication configuration
DELETE /api/mysql/replication
# Skip replication error
POST /api/settings/mysql/replication/skip-error
# Restart replication
POST /api/settings/mysql/replication/restart
# Set slave skip errors
POST /api/settings/mysql/slave-skip-errors
{ "errors": "1062,1032" }
Replication Endpoints (Called by Slaves)
Several replication endpoints are public (no JWT) but protected by a shared token - they're called server-to-server by slave nodes:
POST /api/mysql/replication/acceptPOST /api/mysql/replication/setup-masterPOST /api/mysql/replication/dumpPOST /api/mysql/replication/position
Sync Users for HA¶
When using ProxySQL for high-availability, sync MySQL users between servers:
MySQL Host¶
Returns the MySQL host used by the panel (usually localhost).