MySQL
Deploy MySQL 8 with persistent storage — relational database with auto-generated credentials
Ink deploys MySQL 8 as a container service with a persistent volume. Your agent provisions the database using a template, and Ink returns generated root credentials plus a connection string.
Deploying
Your agent uses the template_deploy MCP tool:
template_deploy(
"template": "mysql",
"name": "my-db"
){
"services": [object Object],
"outputs": [object Object]
}Or via the CLI:
ink template deploy mysql --name my-dbAuto-generated credentials
| Variable | Value |
|---|---|
MYSQL_ROOT_PASSWORD | Auto-generated at deploy time |
MYSQL_DATABASE | railway |
connection_string output | Full connection string with generated credentials |
Passwords are randomly generated. The agent receives them as outputs — no manual password management required.
Persistent storage
A persistent volume is attached at /var/lib/mysql (10 Gi default). Data survives container restarts and redeployments.
Connecting
After deployment, template_deploy returns a connection_string output in the format:
mysql://root:pass@hostname:3306/dbnameThe response also includes service endpoints. Sibling services in the same project can use the returned internal endpoint; external clients should use the returned connection string and generated password.
Client libraries
Node.js
npm install mysql2import mysql from 'mysql2/promise';
const connection = await mysql.createConnection(process.env.DATABASE_URL);
const [rows] = await connection.execute('SELECT * FROM users');Python
pip install mysql-connector-pythonimport os
import mysql.connector
from urllib.parse import urlparse
url = urlparse(os.environ["DATABASE_URL"])
conn = mysql.connector.connect(
host=url.hostname,
port=url.port or 3306,
user=url.username,
password=url.password,
database=url.path.lstrip("/")
)
cursor = conn.cursor()
cursor.execute("SELECT * FROM users")Specs
| Property | Value |
|---|---|
| Engine | MySQL 8 |
| Image | mysql:8 |
| Port | 3306 |
| Volume | /var/lib/mysql |
| Default Memory | 512Mi |
| Default vCPU | 0.5 |