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 — credentials are auto-generated and returned immediately.
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 |
DATABASE_URL | 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 (1 Gi default). Data survives container restarts and redeployments.
Connecting
After deployment, template_deploy returns a DATABASE_URL in the format:
mysql://root:pass@hostname:3306/dbnameThe internal URL (my-db:3306) is used for service-to-service communication within the same project. Any sibling service can connect by hostname — no external networking required.
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
conn = mysql.connector.connect(
host="my-db",
port=3306,
user="root",
password=os.environ["MYSQL_ROOT_PASSWORD"],
database="railway"
)
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 |