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.
- Drop your CSV onto the converter above (or click to choose a file).
- Review the schema. SQLified infers MySQL types and adds an auto-increment key. Adjust types, nullability, rename columns, or set your own primary key.
- Generate the SQL — a
CREATE TABLEplus batchedINSERTstatements. - Run it in MySQL Workbench, the
mysqlCLI, 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, orBIGINTbeyond the 32-bit range. - Decimals →
DECIMAL(18, n)sized to your data. - Dates and timestamps →
DATEorDATETIME. true/false→TINYINT(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.