Back to Blog
Tutorial5 min read2026-05-01

How to Host MySQL for Free on PandaStack

PandaStack supports managed MySQL as a first-class database type. Spin one up in seconds, get your connection string, and connect from any app.

# How to Host MySQL for Free on PandaStack

MySQL remains the world's most widely deployed open-source database, powering PHP applications, WordPress, Drupal, and countless legacy systems. PandaStack offers managed MySQL alongside PostgreSQL, Redis, and MongoDB — no separate database service required.

What You Get with PandaStack Managed MySQL

  • Fully managed MySQL 8.x instance
  • Automatic backups
  • Monitoring and alert integration
  • SSL-encrypted connections
  • Dashboard management (no SSH required)
  • Connection pooling

Step 1: Create a MySQL Database

  1. 1Log in to [dashboard.pandastack.io](https://dashboard.pandastack.io)
  2. 2Click Databases in the sidebar
  3. 3Click New Database
  4. 4Select MySQL
  5. 5Name your database and click Create

Your MySQL instance is ready in about 60 seconds.

Step 2: Get Your Connection Details

From the database dashboard, copy your connection string:

mysql://username:password@db.pandastack.io:3306/your_database_name

Individual connection parameters are also displayed for applications that require them.

Step 3: Connect via MySQL CLI

mysql -h db.pandastack.io       -u username       -p       --ssl-mode=REQUIRED       your_database_name

# Enter password when prompted

Or with the connection string:

mysql "mysql://username:password@db.pandastack.io:3306/your_database_name?ssl-mode=REQUIRED"

Step 4: Connect from Node.js

Using the mysql2 package (recommended for modern Node.js):

import mysql from 'mysql2/promise'

const pool = mysql.createPool({
    uri: process.env.DATABASE_URL,
    ssl: { rejectUnauthorized: true },
    connectionLimit: 10,
    waitForConnections: true,
})

// Query example
const [rows] = await pool.query('SELECT NOW() AS now')
console.log(rows[0].now)

Install: npm install mysql2

Step 5: Connect from PHP (Laravel / Raw PHP)

Laravel .env:

DB_CONNECTION=mysql
DB_HOST=db.pandastack.io
DB_PORT=3306
DB_DATABASE=your_database_name
DB_USERNAME=username
DB_PASSWORD=password

Raw PHP with PDO:

$pdo = new PDO(
    'mysql:host=db.pandastack.io;port=3306;dbname=your_database_name',
    'username',
    'password',
    [PDO::MYSQL_ATTR_SSL_CA => '/etc/ssl/certs/ca-certificates.crt']
);

Step 6: Connect from Python

import mysql.connector
import os

conn = mysql.connector.connect(
    host='db.pandastack.io',
    port=3306,
    user=os.environ['DB_USER'],
    password=os.environ['DB_PASSWORD'],
    database=os.environ['DB_NAME'],
    ssl_ca='/etc/ssl/certs/ca-certificates.crt',
)

Step 7: Set Environment Variables in PandaStack

In your deployment settings, add:

DATABASE_URL=mysql://username:password@db.pandastack.io:3306/your_database_name

This keeps credentials out of your codebase.

Step 8: Monitor and Backup

From the database dashboard:

  • View active connections and slow queries
  • Enable alerts for connection limit warnings (email, Slack, or webhook)
  • View backup history
  • Trigger a manual backup before major schema changes

When to Use MySQL vs PostgreSQL

Use MySQL when:

  • Your application framework explicitly requires it (WordPress, Drupal, many PHP frameworks)
  • You are migrating an existing MySQL application
  • Your team has strong MySQL expertise

Use PostgreSQL when:

  • You are starting a new project
  • You need advanced features (JSON queries, full-text search, window functions)
  • Your ORM has better PostgreSQL support

Both are available on PandaStack from the same dashboard. Full docs: [docs.pandastack.io](https://docs.pandastack.io).

Ready to deploy?

Start free on PandaStack — no credit card required.

Start free on PandaStack

More in Tutorial

Browse all Tutorial articles →

See also