MySQL
Managed MySQL with automated backups, point-in-time recovery, and private internal networking.
Powered by MariaDB
Supported versions
StackBlaze supports MySQL 8.0 and MySQL 8.4. MySQL 8.4 is the current LTS release and is recommended for new projects. Both versions include full InnoDB support, JSON functions, window functions, and CTEs.
| Version | Status | Notes |
|---|---|---|
| MySQL 8.4 | Recommended | LTS release, default for new instances |
| MySQL 8.0 | Supported | EOL January 2026, consider migrating |
Creating a MySQL instance
From the dashboard, click New service → Database → MySQL. Select a version, storage size (1 GB to 500 GB), and plan. StackBlaze provisions a Kubernetes StatefulSet with a PersistentVolumeClaim and a stable ClusterIP Service.
To connect your MySQL instance to a service, go to the service's Environment tab and click Attach database. StackBlaze injects DATABASE_URL automatically.
Connection strings
Internal (recommended for production)
Services in the same project connect to MySQL via its internal hostname, which resolves to a stable ClusterIP. No internet exposure, no TLS overhead.
mysql://user:password@[service-name].internal:3306/dbname
External (for local development tools)
Use the external connection string for GUI clients like TablePlus, MySQL Workbench, or DBeaver. Connections are secured via SSL. Find the external URL in Settings → Connection.
mysql://user:password@db.stackblaze.cloud:3306/dbname?ssl=true
Running migrations
Configure a pre-deploy command under Settings → Deploy → Pre-deploy command to ensure migrations run before new traffic is routed to your service.
Prisma
npx prisma migrate deploy
Flyway
flyway -url=jdbc:mysql://[service-name].internal:3306/dbname -user=$DB_USER -password=$DB_PASSWORD migrate
Liquibase
liquibase --url=jdbc:mysql://[service-name].internal:3306/dbname --username=$DB_USER --password=$DB_PASSWORD --changeLogFile=db/changelog/changelog.xml update
Node.js / Knex
npx knex migrate:latest
Tip
DATABASE_URL environment variable is available in your pre-deploy container. Most ORMs and migration tools pick it up automatically. For JDBC-based tools (Flyway, Liquibase), parse the URL components into separate variables in your CI/CD configuration.Automated backups
All plans include daily automated snapshots. Backups are encrypted with AES-256 before leaving the host and stored in a separate availability zone from your data.
To restore from a snapshot: navigate to your database → Backups → select a snapshot → Restore. You can restore to a new instance without interrupting your live database.
Point-in-time recovery (PITR)
On Pro and Enterprise plans, StackBlaze continuously ships binary logs to object storage. This enables recovery to any point within the retention window with ~1-minute granularity.
| Plan | PITR | Retention window |
|---|---|---|
| Free | No | - |
| Starter | No | 3 days (snapshots only) |
| Pro | Yes | 7 days |
| Enterprise | Yes | 30 days |
Character sets and collations
New MySQL instances default to utf8mb4 charset with utf8mb4_unicode_ci collation, the correct choice for modern applications that need full Unicode support including emoji.
SHOW VARIABLES LIKE 'character_set%'; SHOW VARIABLES LIKE 'collation%';
Connecting with common ORMs
Prisma (MySQL provider)
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}TypeORM
import { DataSource } from 'typeorm'
export const AppDataSource = new DataSource({
type: 'mysql',
url: process.env.DATABASE_URL,
entities: ['src/entities/**/*.ts'],
migrations: ['src/migrations/**/*.ts'],
})SQLAlchemy (Python)
from sqlalchemy import create_engine
# Replace mysql:// with mysql+pymysql:// for PyMySQL driver
url = os.environ["DATABASE_URL"].replace("mysql://", "mysql+pymysql://", 1)
engine = create_engine(url, pool_pre_ping=True)Under the hood
[service-name].internal. The StatefulSet uses podManagementPolicy: OrderedReady to ensure clean startup and shutdown ordering.