Convert PostgreSQL schemas, queries, and data types to MySQL/MariaDB syntax. Handles SERIAL→AUTO_INCREMENT, double quotes to backticks, data types, LIMIT/OFFSET, and common functions.
While PostgreSQL is widely praised for advanced features, MySQL (especially with InnoDB) remains the backbone of countless web applications, shared hosting environments, and legacy systems. Migrating from PostgreSQL to MySQL may be driven by lower operational costs, managed cloud services (Amazon RDS for MySQL), or compatibility with existing LAMP stacks. This converter handles the heavy lifting of syntax translation, allowing developers to focus on application logic and data integrity verification.
LIMIT count OFFSET offset → LIMIT offset, count (MySQL syntax)
| PostgreSQL Type | MySQL Type | Behavior notes |
|---|---|---|
| SERIAL, SERIAL4 | INT AUTO_INCREMENT | Primary key with auto increment |
| BIGSERIAL, SERIAL8 | BIGINT AUTO_INCREMENT | Large auto-increment |
| BOOLEAN | TINYINT(1) | MySQL uses TINYINT(1) as boolean convention |
| NUMERIC(prec, scale) | DECIMAL(prec, scale) | Exact numeric identical |
| VARCHAR(n) | VARCHAR(n) | Same length semantics |
| TEXT | TEXT / LONGTEXT | Compatible, but MySQL TEXT has 64KB limit |
| JSONB / JSON | JSON | MySQL JSON type (8.0+) |
| TIMESTAMP / TIMESTAMPTZ | TIMESTAMP | Timezone conversion requires manual handling |
| ARRAY (any) | — | Not supported; converter adds comment |
| UUID | CHAR(36) or BINARY(16) | Added as CHAR(36) with note |
A real‑time analytics company migrated from PostgreSQL 13 to MySQL 8.0 to leverage a managed database platform with lower latency for write‑heavy workloads. The conversion involved 45 tables, 130 indexes, and dozens of views. Using this converter, they automated 85% of DDL transformations. Notable challenges: converting window functions (ROW_NUMBER) which are fully supported in MySQL 8.0, and replacing STRING_AGG with GROUP_CONCAT. After migration, write throughput improved 22% due to MySQL’s clustered index design on InnoDB.
ALTER TABLE t AUTO_INCREMENT = value if needed.
mysqldump with proper compatibility flags or ETL tools.
-- ARRAY type removed: manual normalization required. You must redesign your schema using junction tables or JSON.
LIKE and a comment suggesting the use of COLLATE utf8mb4_general_ci for case‑insensitive searches, or the LOWER() function.