Convert a Snowflake schema to MySQL
Paste the CREATE TABLE statements from Snowflake and ERD Designer draws them as a diagram. Change the diagram's target database to MySQL and every column's datatype is converted. You review each change before it is applied, then generate the MySQL script.
What changes in the sample
Converted to MySQL 8.4, these columns of the sample above change type. Everything else keeps its type; names, keys, nullability and lists of allowed values are left as they are.
| Column | Snowflake | MySQL | Note |
|---|---|---|---|
CUSTOMERS.CUSTOMER_ID | NUMBER(38,0) | BIGINT | numbered by the database |
CUSTOMERS.NOTES | VARCHAR | LONGTEXT | |
CUSTOMERS.CREATED_AT | TIMESTAMP_TZ | DATETIME(6) | default: CURRENT_TIMESTAMP() → CURRENT_TIMESTAMP |
ORDERS.ORDER_ID | NUMBER(38,0) | BIGINT | numbered by the database |
ORDERS.CUSTOMER_ID | NUMBER(38,0) | BIGINT | |
ORDERS.TOTAL | NUMBER(12,2) | DECIMAL(12,2) | |
ORDERS.PLACED_AT | TIMESTAMP_NTZ(3) | DATETIME(3) | |
ORDERS.RECEIPT_PDF | BINARY | LONGBLOB |
What it tells you
Where a conversion loses something, ERD Designer says so rather than picking for you. These are the messages for the sample:
- CUSTOMERS.CREATED_AT: MySQL has no timestamp with a time zone — "TIMESTAMP_TZ" became DATETIME, which stores the local time without its offset. Store the values in UTC, or keep the offset in a column of its own. CUSTOMERS.CREATED_AT: MySQL keeps at most 6 fractional-second digits — "(9)" became (6).
The MySQL script
This is what ERD Designer generates for the sample, for MySQL 8.4. Our test suite applies this conversion to a real MySQL server and then reads the database back to confirm it matches the diagram exactly.
-- Create table CUSTOMERS
CREATE TABLE `CUSTOMERS` (
`CUSTOMER_ID` BIGINT NOT NULL AUTO_INCREMENT,
`EMAIL` VARCHAR(255) NOT NULL,
`FULL_NAME` VARCHAR(120) NOT NULL,
`NOTES` LONGTEXT NULL,
`IS_ACTIVE` TINYINT(1) NOT NULL DEFAULT 1,
`CREATED_AT` DATETIME(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
PRIMARY KEY (`CUSTOMER_ID`)
) ENGINE=InnoDB;
-- Create table ORDERS
CREATE TABLE `ORDERS` (
`ORDER_ID` BIGINT NOT NULL AUTO_INCREMENT,
`CUSTOMER_ID` BIGINT NOT NULL,
`PUBLIC_ID` VARCHAR(36) NOT NULL,
`STATUS` VARCHAR(10) NOT NULL DEFAULT 'new',
`TOTAL` DECIMAL(12,2) NOT NULL,
`PLACED_AT` DATETIME(3) NOT NULL,
`RECEIPT_PDF` LONGBLOB NULL,
PRIMARY KEY (`ORDER_ID`)
) ENGINE=InnoDB;
-- Add unique constraint on CUSTOMERS (EMAIL)
ALTER TABLE `CUSTOMERS` ADD CONSTRAINT `CUSTOMERS_EMAIL_UQ` UNIQUE (`EMAIL`);
-- Add foreign key ORDERS (CUSTOMER_ID) → CUSTOMERS (CUSTOMER_ID)
ALTER TABLE `ORDERS` ADD CONSTRAINT `ORDERS_FK1` FOREIGN KEY (`CUSTOMER_ID`) REFERENCES `CUSTOMERS` (`CUSTOMER_ID`);
How to convert your own schema
- Paste your Snowflake script above and press Open in ERD Designer. The diagram opens laid out and ready to edit.
- Click the diagram's name in the toolbar to open its properties, choose MySQL under Target Database / Version, and press Apply Changes.
- If MySQL offers more than one way to store a kind of column, choose one and press Continue.
- Read the list of retyped columns and any warnings, then press Apply Conversion. Save the diagram to keep it.
- Press Generate DDL (the database icon) to copy or download the MySQL script — or apply it to a database on your own network with the ERD Designer Agent.
What it reads, and what it does not
- It reads
CREATE TABLE,ALTER TABLE … ADD CONSTRAINTandCREATE INDEX: tables, columns, keys, foreign keys, unique constraints, check lists and indexes. Anything else in the script is skipped and listed. - It converts the schema, never the data: no rows are read, moved or changed.
- It does not convert views, stored procedures, functions, triggers or packages.
Which plan you need
Pasting a script and working with it as a diagram is free on the Basic plan, with no card. Converting a diagram to another database is part of the Pro and Advanced plans, which also generate its script and can apply it through the Agent.
Other conversions
- Snowflake to PostgreSQL
- Snowflake to Oracle
- Snowflake to SQL Server
- Snowflake to MariaDB
- Snowflake to SQLite
- Snowflake to Amazon Redshift
- Snowflake to Google BigQuery
- PostgreSQL to MySQL
- Oracle to MySQL
- SQL Server to MySQL
- MariaDB to MySQL
- SQLite to MySQL
- Amazon Redshift to MySQL
- Google BigQuery to MySQL
Questions? Write to support@erddesigner.com. · ERD Designer · Terms · Privacy