Create FasterCreate Faster

MySQL

MySQL is the world's most popular open-source relational database, trusted by millions of applications worldwide.

→ MySQL Documentation

What create-faster adds

Beyond the official setup, we include:

Docker Compose Configuration:

  • Pre-configured mysql:8 service
  • Project-specific naming (mysql-{projectName})
  • Persistent data volume
  • Health check with mysqladmin ping over TCP, so docker compose up -d --wait returns once the published port accepts connections
  • Connection limit (100 max connections)
  • Dedicated network for isolation

File created:

docker-compose.yml          # MySQL service configuration

Service Configuration:

  • Image: mysql:8
  • Container: mysql-{projectName}
  • Port: 3306 (MySQL default)
  • Restart: always

Environment Variables:

  • MYSQL_ROOT_PASSWORD: password (change in production)
  • MYSQL_DATABASE: mysql-{projectName}
  • MYSQL_USER: mysql
  • MYSQL_PASSWORD: password

Volume:

  • mysql-{projectName}-data:/var/lib/mysql (persistent storage)

Network:

  • mysql-{projectName}-network (bridge network for isolation)

Command:

  • --max-connections=100 - Connection pooling limit

Health Check:

  • Test: mysqladmin ping -h 127.0.0.1 -u root -ppassword
  • Interval: 10s, Timeout: 5s, Retries: 5
  • Start period: 30s for initialization

Connection String:

mysql://mysql:password@localhost:3306/mysql-{projectName}?ssl=false

TLS

The generated database client (Drizzle or Prisma) asks its driver for TLS and certificate verification when NODE_ENV=production. In development it connects without TLS. An ssl parameter in DATABASE_URL always wins over that default. The two drivers read it differently:

  • Drizzle uses mysql2, which reads ssl as JSON: an object turns TLS on (ssl={"rejectUnauthorized":false} skips the certificate check), ssl=false turns it off, and ssl=true is rejected.
  • Prisma uses the MariaDB connector behind its adapter, which reads ssl=true as TLS with certificate verification and every other value as no TLS.

In production, use the managed database's connection string without ssl: the client adds the parameter its driver needs. NODE_ENV=production comes from the same places as for PostgreSQL: next build and vite build inline it, and the start script of a Hono or Node app sets it.

The Docker image serves a self-signed certificate, which a client that asks for TLS rejects, so the generated .env.example URL ends with ?ssl=false and a production build runs against the local database. Keep ssl=false for local or other non-TLS databases only, and never copy the local DATABASE_URL to production: in production, the generated client logs a warning when DATABASE_URL sets ssl=false for a host other than localhost. The last ssl parameter wins, and a host parameter counts as a host too.

With Drizzle or Prisma on Cloudflare, the Worker reaches the database through the HYPERDRIVE binding instead, whose connection to the database is configured on the Hyperdrive side. DATABASE_URL then only serves the migration CLI (drizzle-kit or prisma) and the seed script.

On this page