Does MySQL Work With Payload CMS?

Fully CompatibleLast verified: 2026-02-26

Yes, Payload CMS fully supports MySQL as a database backend through its database abstraction layer, making it a production-ready combination.

Quick Facts

Compatibility
full
Setup Difficulty
Easy
Official Integration
Yes ✓
Confidence
high
Minimum Versions
MySQL: 5.7
Payload CMS: 2.0

How MySQL Works With Payload CMS

Payload CMS uses Drizzle ORM which abstracts database operations, allowing you to swap between PostgreSQL, MySQL, and SQLite without changing your CMS code. MySQL integration is officially supported and equally robust as PostgreSQL. During initialization, you select MySQL as your database type, and Payload handles migrations, schema generation, and queries automatically. The developer experience is seamless—you define your collection schemas in TypeScript, and Payload generates the appropriate MySQL tables and relationships. MySQL's row-based storage works well with Payload's document-centric content model, though you'll want to ensure your MySQL server has proper indexing for frequently queried fields. Performance is comparable to PostgreSQL for most CMS workloads, though MySQL's JSON column support (version 5.7+) enables efficient storage of Payload's flexible field structures.

Best Use Cases

Building headless CMS solutions for teams already standardized on MySQL infrastructure
Migrating existing MySQL-based applications that need a content management layer
Cost-conscious deployments where MySQL hosting is cheaper than PostgreSQL alternatives
WordPress ecosystem integrations where MySQL is the established database standard

Quick Setup

bash
npm create payload-app@latest -- --template blank --db mysql
typescript
// payload.config.ts
import { buildConfig } from 'payload/config';
import { mysqlAdapter } from '@payloadcms/db-mysql';

export default buildConfig({
  admin: { user: process.env.PAYLOAD_SECRET },
  collections: [
    {
      slug: 'posts',
      fields: [
        { name: 'title', type: 'text', required: true },
        { name: 'content', type: 'richText' },
        { name: 'published', type: 'checkbox' },
      ],
    },
  ],
  db: mysqlAdapter({
    url: process.env.DATABASE_URI, // mysql://user:pass@localhost:3306/payload_db
  }),
});

Known Issues & Gotchas

warning

MySQL's default max_allowed_packet is 4MB, which can truncate large media metadata or rich text fields

Fix: Increase max_allowed_packet to 64MB or higher in MySQL configuration: set global max_allowed_packet=67108864

warning

Full-text search performance in MySQL is slower than PostgreSQL for large content libraries

Fix: Implement Elasticsearch or Meilisearch as a dedicated search layer alongside MySQL for production content sites

info

JSON column queries lack some advanced operators that PostgreSQL offers, limiting complex nested field queries

Fix: Denormalize frequently-queried nested fields into separate indexed columns for better performance

Alternatives

  • PostgreSQL + Payload CMS - slightly better full-text search and JSON operators, but requires PostgreSQL hosting
  • SQLite + Payload CMS - easiest local development option, not recommended for production
  • Strapi + PostgreSQL - alternative Node.js headless CMS with different architecture philosophy

Resources

Related Compatibility Guides

Explore more compatibility guides