Convert a Oracle schema to MySQL
Paste the CREATE TABLE statements from Oracle 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 | Oracle | MySQL | Note |
|---|---|---|---|
CUSTOMERS.CUSTOMER_ID | NUMBER | BIGINT | numbered by the database |
CUSTOMERS.EMAIL | VARCHAR2(255) | VARCHAR(255) | |
CUSTOMERS.FULL_NAME | NVARCHAR2(120) | VARCHAR(120) | |
CUSTOMERS.NOTES | CLOB | LONGTEXT | |
CUSTOMERS.CREATED_AT | DATE | DATETIME | default: SYSDATE → CURRENT_TIMESTAMP |
ORDERS.ORDER_ID | NUMBER | BIGINT | numbered by the database |
ORDERS.CUSTOMER_ID | NUMBER | BIGINT | |
ORDERS.STATUS | VARCHAR2(20) | VARCHAR(20) | |
ORDERS.TOTAL | NUMBER(12,2) | DECIMAL(12,2) | |
ORDERS.PLACED_AT | TIMESTAMP(6) WITH TIME ZONE | DATETIME(6) | |
ORDERS.RECEIPT_PDF | BLOB | LONGBLOB |
What you are asked
Where MySQL offers more than one fair answer, ERD Designer asks before it converts — once per kind of column, not once per column. For this page each question was answered with its first option:
Auto-numbered keys — answered BIGINT
BIGINT— AUTO_INCREMENT; holds every key the source can hold — twice the width of INT everywhere it is referencedINT— AUTO_INCREMENT; about 2.1 billion values — choose it only if the keys stay below that
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:
- ORDERS.PLACED_AT: MySQL has no timestamp with a time zone — "TIMESTAMP(6) WITH TIME ZONE" 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.
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,
`CREATED_AT` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`CUSTOMER_ID`)
) ENGINE=InnoDB;
-- Create table ORDERS
CREATE TABLE `ORDERS` (
`ORDER_ID` BIGINT NOT NULL AUTO_INCREMENT,
`CUSTOMER_ID` BIGINT NOT NULL,
`STATUS` VARCHAR(20) NOT NULL DEFAULT 'new' CHECK (`STATUS` IN ('new', 'paid', 'shipped')),
`TOTAL` DECIMAL(12,2) NOT NULL,
`PLACED_AT` DATETIME(6) NOT NULL,
`RECEIPT_PDF` LONGBLOB NULL,
PRIMARY KEY (`ORDER_ID`)
) ENGINE=InnoDB;
-- Add unique constraint on CUSTOMERS (EMAIL)
ALTER TABLE `CUSTOMERS` ADD CONSTRAINT `CUSTOMERS_UQ1` UNIQUE (`EMAIL`);
-- Create index on ORDERS (PLACED_AT)
CREATE INDEX `ORDERS_PLACED_IX` ON `ORDERS` (`PLACED_AT`);
-- 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 Oracle 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
- Oracle to PostgreSQL
- Oracle to SQL Server
- Oracle to MariaDB
- Oracle to SQLite
- Oracle to Amazon Redshift
- Oracle to Google BigQuery
- Oracle to Snowflake
- PostgreSQL to MySQL
- SQL Server to MySQL
- MariaDB to MySQL
- SQLite to MySQL
- Amazon Redshift to MySQL
- Google BigQuery to MySQL
- Snowflake to MySQL
Questions? Write to support@erddesigner.com. · ERD Designer · Terms · Privacy