PostgreSQL to MySQL converter

Paste PostgreSQL queries or CREATE TABLE statements and get MySQL. The converter rewrites types, casts and functions, and tells you what it changed and what needs your attention.

Runs in your browser. Your SQL is never sent anywhere.

Output · MySQL

How to use it

  1. 1Paste PostgreSQL SQL: one query, a CREATE TABLE, or a whole script.
  2. 2Read the MySQL output on the right. Casts, types, || and functions are converted.
  3. 3Open "Check these by hand": arrays, time zones, RETURNING and similar have no direct MySQL form.
  4. 4Copy the result and run it against MySQL.

Frequently asked questions

What does it convert?

Double-quoted names, SERIAL and IDENTITY to AUTO_INCREMENT, BOOLEAN, TIMESTAMPTZ, UUID, JSONB and BYTEA types, :: casts to CAST, || to CONCAT, ILIKE, regular expression operators, STRING_AGG, TO_CHAR, date_trunc, INTERVAL values, FETCH FIRST, INSERT … ON CONFLICT, and $1 parameters.

What cannot be converted?

Arrays, RETURNING, DISTINCT ON, NULLS FIRST/LAST, EXCLUDE constraints, sequences, extensions and PL/pgSQL functions have no direct MySQL equivalent. The converter comments them out or flags them so you decide what to do.

Why does a UUID column become CHAR(36)?

MySQL has no native UUID type. CHAR(36) is the common choice; BINARY(16) is smaller if you convert with UUID_TO_BIN.

Is my SQL sent anywhere?

No. The conversion runs in your browser, so schemas and queries stay on your machine.

Does it work for whole migrations?

It handles the SQL. For the data itself, export to CSV or use a migration tool, then load into MySQL. Spectre connects to both databases so you can check the result on each side.

More free SQL tools

Do it on your real database with Spectre

Spectre is the AI database studio for PostgreSQL, MySQL and SQL Server. Ask in plain language, get SQL and answers backed by your data, and keep it all on your machine.