SwapSQL

PostgreSQL → MySQL

Convert PostgreSQL text to MySQL

PostgreSQL's text is unlimited, so the only always-safe MySQL target is LONGTEXT (4 GB). Indexes on such columns need MySQL's prefix-length syntax.

text LONGTEXT

What to know

Before / after

PostgreSQL

CREATE TABLE posts (
  body text
);
CREATE INDEX idx_body ON posts (body);

MySQL

CREATE TABLE posts (
  body LONGTEXT,
  KEY idx_body (body(191))
);

Don't convert column-by-column — convert the whole database.

Upload a dump, get back ready-to-import SQL with this mapping (and every other one) applied.

Open the PostgreSQL → MySQL converter

See the full type mapping table or all guides.