MySQL
MySQL is provisioned automatically when Jetpacked detects it from your repository. A dedicated instance is created for your project and the connection string is injected as DATABASE_URL before your app starts.
Detection
Jetpacked detects MySQL from:
mysql,mysql2, or@planetscale/databasein your dependencies- A Prisma schema with
provider = "mysql" - A Drizzle config pointing to a mysql adapter
typeormwith a mysql driver
Auto-injected variables
| Variable | Value |
|---|---|
DATABASE_URL |
mysql://user:password@host:3306/dbname |
MYSQL_USER |
Username (default: jetpacked) |
MYSQL_DATABASE |
Database name (default: your project slug) |
MYSQL_PASSWORD |
Auto-generated password |
Migrations
Prisma
Jetpacked runs prisma generate before the build and prisma migrate deploy after it.
Drizzle
Jetpacked runs drizzle-kit migrate after the build if a drizzle.config.* file is present.
TypeORM
Jetpacked runs typeorm migration:run after the build.
Using an external database
If you want to use an existing MySQL instance instead of a provisioned one, add DATABASE_URL manually in the Environment tab. Your value takes precedence over the auto-injected one.
Viewing credentials
Generated credentials can be viewed in plain text in the Environment tab of your project.
Available service slots
You can reference MySQL values in other environment variables using service slots. See Service Slots for full details.
| Slot | Resolves to |
|---|---|
$mysql.url |
Full connection URL |
$mysql.host |
Hostname |
$mysql.port |
Port number |
$mysql.user |
Username |
$mysql.password |
Password |
$mysql.name |
Database name |