SwapSQL

WordPress on PostgreSQL: the honest answer

Searching for "migrate WordPress to PostgreSQL" usually means one of two very different things. One of them is a trap; the other is a perfectly good idea. This page is blunt about which is which, because most guides aren't.

The hard fact: WordPress core requires MySQL

WordPress's official requirements list MySQL 5.7+ or MariaDB 10.4+ — and nothing else. The core, wp-admin, and the entire plugin and theme ecosystem are written against MySQL. Thousands of plugins issue raw MySQL SQL through $wpdb (functions, backtick quoting, ON DUPLICATE KEY UPDATE, MySQL-specific date math). PostgreSQL is not a drop-in replacement for any of that.

There has historically been one bridge: PG4WP (PostgreSQL for WordPress), a db.php drop-in that rewrites queries on the fly. It can boot a vanilla install, but it is community-maintained, lags new WordPress releases, and only translates the queries it knows about. Any plugin that reaches for a MySQL-only feature breaks — often silently, on a specific admin screen, months later.

When NOT to do it

The one case where it pays off

The legitimate reason to convert a WordPress database to PostgreSQL is to get the data out, not to keep WordPress running on it. Examples:

In all of these, WordPress stays on MySQL; you simply produce a PostgreSQL copy of the schema and rows. That is a clean dialect conversion, not a doomed application port.

How to get the data into PostgreSQL

Export the WordPress database with mysqldump:

mysqldump --single-transaction --no-tablespaces \
  -u root -p wordpress > wordpress.sql

Then convert the dialect — the wp_ tables use AUTO_INCREMENT, longtext, tinyint and backtick quoting that all need translating to PostgreSQL equivalents (sequences/identity, text, boolean/smallint, double-quote quoting). Load the result with:

psql -d wp_warehouse -f converted.sql

A note on encoding: WordPress uses utf8mb4, so emoji and multi-byte content are common. PostgreSQL is UTF-8 throughout and handles them natively — no utf8mb4 dance required on the way in.

The bottom line

Don't try to run live WordPress on PostgreSQL — it's unsupported and fragile. Do convert the WordPress database to PostgreSQL when you need the content inside a PostgreSQL system for reporting or as part of a migration off WordPress entirely.

Need the wp_ tables in PostgreSQL? Convert your WordPress dump now →