SwapSQL

PostgreSQL → MySQL

Convert PostgreSQL serial and identity columns to MySQL

Sequences don't exist in MySQL; auto-numbering belongs to the column itself. serial, bigserial and GENERATED … AS IDENTITY all become AUTO_INCREMENT.

serial / identity AUTO_INCREMENT

What to know

Before / after

PostgreSQL

CREATE TABLE posts (
  id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY
);

MySQL

CREATE TABLE posts (
  id BIGINT NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (id)
) AUTO_INCREMENT=12345;

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.