CSV → MySQL

Convert CSV to MySQL SQL

Drop a CSV and get a ready-to-run CREATE TABLE + INSERT script for MySQL — with smart type inference and an auto-increment primary key. Runs in your browser, nothing uploaded.

Drop or choose your file to start...
Choose a file...

MySQL-ready output

CREATE TABLE + INSERT statements built for MySQL and MariaDB.

Auto-increment key

Adds an AUTO_INCREMENT id primary key when your data doesn't define one.

MySQL types

Detects INT, BIGINT, DECIMAL, DATETIME, TINYINT(1), and TEXT from your data.

Big files welcome

INSERTs are batched so you never hit max_allowed_packet on large imports.

Schema control

Override inferred types, rename columns, and set your own primary key.

Private by design

Processed in memory, in your browser, never stored.

How to convert a CSV file to MySQL

The fast server-side way to load a CSV into MySQL is LOAD DATA INFILE — but it needs file access and the right privileges, which managed MySQL hosts (PlanetScale, RDS, Cloud SQL) often lock down. SQLified gives you the portable alternative: drop your CSV and get a clean CREATE TABLE + INSERT script you can paste into any MySQL client.

  1. Drop your CSV onto the converter above (or click to choose a file).
  2. Review the schema. SQLified infers MySQL types and adds an auto-increment key. Adjust types, nullability, rename columns, or set your own primary key.
  3. Generate the SQL — a CREATE TABLE plus batched INSERT statements.
  4. Run it in MySQL Workbench, the mysql CLI, or phpMyAdmin.

What the generated SQL looks like

CREATE TABLE IF NOT EXISTS `users` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `name` TEXT NOT NULL,
  `signup_date` DATE NOT NULL,
  `amount` DECIMAL(18,2) NOT NULL,
  PRIMARY KEY (`id`)
);

INSERT INTO `users` (`name`, `signup_date`, `amount`) VALUES
('Ada Lovelace', '2026-01-04', '120.50'),
('Alan Turing', '2026-02-11', '99.00');

Identifiers are backtick-quoted (`column`) per MySQL convention. When your data has no key of its own, SQLified adds an AUTO_INCREMENT id so every row gets a unique primary key out of the box.

MySQL type inference

  • Whole numbers → INT, or BIGINT beyond the 32-bit range.
  • Decimals → DECIMAL(18, n) sized to your data.
  • Dates and timestamps → DATE or DATETIME.
  • true/falseTINYINT(1).
  • Everything else → TEXT.

Override any guess before generating — handy for codes or IDs you want stored as text.

Large files and max_allowed_packet

MySQL rejects any statement bigger than max_allowed_packet — commonly 4 MB on shared hosts and 64 MB by default. A converter that emits one enormous INSERT for a big file will hit that wall. SQLified batches the output into 1,000-row INSERT statements, so each one stays well under the limit and a multi-million-row file imports without tuning anything.

Frequently asked questions

Does SQLified upload my CSV?

No. The whole conversion runs in your browser — the file is read into memory, turned into SQL, and never sent to a server or stored.

How is this different from LOAD DATA INFILE?

LOAD DATA INFILE (and mysqlimport) are fast but need the file on the server or the LOCAL option enabled, plus the right privileges. SQLified's INSERT statements are portable — paste them into MySQL Workbench, the mysql CLI, phpMyAdmin, or any console, which is ideal for managed MySQL like PlanetScale or RDS.

Why does my big import fail with one giant INSERT?

MySQL rejects statements larger than max_allowed_packet (often 4–64 MB). A single INSERT for a large file blows past that. SQLified splits the output into 1,000-row batches so each statement stays small and imports cleanly.

Will it add a primary key?

If your data doesn't already have one, SQLified adds an AUTO_INCREMENT id column as the primary key. If you mark one of your own columns as the key, it uses that instead.

Can I change the inferred types?

Yes — override any column's MySQL type, rename it, mark it nullable, or set a primary key before generating the script.