Migration combines pg_dump export, SQL conversion, and MySQL-compatible import so PostgreSQL data lands safely in MariaDB.
Teams switch to MariaDB when they need MySQL compatibility, easier replication, or lower license costs while keeping open-source benefits.
pg_dump produces portable data, pgloader auto-converts types, and the mariadb client imports the final SQL into the target database.
INTEGER ➜ INT, SERIAL ➜ INT AUTO_INCREMENT, BOOLEAN ➜ TINYINT(1), TIMESTAMPTZ ➜ DATETIME, JSONB ➜ JSON or TEXT depending on features needed.
Create a schema-only file so MariaDB gets tables but no data collisions.
pg_dump -h localhost -U postgres -d shopdb \
--schema-only --no-owner --no-acl \
--file=shopdb_schema.sql
Search & replace SERIAL, JSONB, and ARRAY columns, or let pgloader handle them automatically.
pg_dump -h localhost -U postgres -d shopdb \
--data-only --column-inserts \
--file=shopdb_data.sql
CREATE DATABASE shopdb;
mariadb -u root -p shopdb < shopdb_schema.sql
mariadb -u root -p shopdb < shopdb_data.sql
Run row counts on key tables like Customers and Orders in both databases and compare results; any mismatch flags issues fast.
Disable foreign keys during bulk load, chunk data per table, and run imports during low-traffic windows to reduce downtime.
.
Yes. Take an initial dump, restore to MariaDB, then replicate incremental changes with triggers or logical replication until cutover.
pgloader converts most standard types but still review JSONB, arrays, and custom extensions for manual tweaks.
PL/pgSQL code is not compatible. Rewrite logic in MariaDB’s SQL/PSM or move it to application code.