Convert CSV to MySQL
Ready-to-run SQL
in seconds.
Free CSV to MySQL converter. Generates CREATE TABLE and INSERT statements with utf8mb4 charset, AUTO_INCREMENT primary key, ON DUPLICATE KEY UPDATE and LOAD DATA INFILE syntax. Runs entirely in your browser.
What makes this different from the generic CSV to SQL converter.
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci — the correct charset for emoji, multilingual data and full Unicode support in modern MySQL.id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY column as the first column — the standard MySQL primary key pattern for most tables.INSERT IGNORE to silently skip rows that violate a UNIQUE constraint — no error, no transaction rollback. For idempotent imports where duplicates should be discarded.Three methods — from fastest to most compatible.
The fastest method for large files. Select LOAD DATA INFILE mode, download the .sql file, place the CSV on the MySQL server, update the file path in the SQL, and run it. Requires the FILE privilege: GRANT FILE ON *.* TO 'user'@'localhost';
Select batch INSERT mode, download the .sql file and run from the command line: mysql -u username -p database_name < file.sql. Works on any server without special privileges. Best for files under 100k rows.
For small datasets, copy the generated SQL to clipboard and paste it directly into MySQL Workbench's query window or phpMyAdmin's SQL tab. Click Execute. No file transfer needed — the SQL runs immediately against the selected database.
Understanding MySQL's two bulk import strategies.
Batch INSERT is the most portable option. It works from any client — the mysql CLI, MySQL Workbench, phpMyAdmin, or any programming language — without special server privileges. Performance can be further improved by wrapping the INSERTs in a transaction: START TRANSACTION; INSERT...; COMMIT;. Typically handles 10,000–50,000 rows per second.
LOAD DATA INFILE is MySQL's native bulk loader — it reads the CSV file directly from the server filesystem and bypasses the SQL parser for individual rows. This makes it 5–20x faster than INSERT for the same data, capable of loading millions of rows per second. The trade-off is that it requires the FILE privilege and the CSV file must be accessible from the MySQL server host — which is not always possible with managed databases (AWS RDS, Google Cloud SQL, PlanetScale).
Common database workflows that start with a CSV file.
Converting a CSV sample dataset to MySQL INSERT statements is the standard way to populate a fresh database schema with realistic test data for development and staging environments.
Product catalogs, customer lists and order history exported from Shopify, WooCommerce or other platforms as CSV are converted to MySQL INSERT statements for importing into a custom database or a different platform.
Using ON DUPLICATE KEY UPDATE, a CSV file can be re-imported to update existing records and insert new ones in a single operation — without deleting and recreating the table or running a complex merge query.
Business data maintained in Excel or Google Sheets often needs to be moved into a MySQL database for web applications or reporting. Converting the spreadsheet to MySQL SQL creates a repeatable, version-controllable import process.
Other free converters on CSVShift you might need.
MySQL SQL generated
in your browser. No upload.
CSVShift generates MySQL INSERT statements and LOAD DATA INFILE syntax entirely in JavaScript in your browser. Your CSV data — which may contain sensitive business records — is never sent to any server. The SQL is built in memory and downloaded or copied directly.
The type inference engine uses MySQL's exact numeric ranges (TINYINT up to 127, SMALLINT up to 32767, MEDIUMINT up to 8,388,607) rather than generic SQL types — producing schemas that store data efficiently without over-allocating column sizes.
mysql -u user -p db < file.sql. 2) Use LOAD DATA INFILE if the CSV is on the MySQL server. For GUI-based imports, use MySQL Workbench's Table Data Import Wizard.ON DUPLICATE KEY UPDATE col = VALUES(col) for every column — effectively upserting the row by updating all non-key fields with the incoming values.df = pd.read_csv('file.csv'); df.to_sql('table', engine, if_exists='append', index=False). Using mysql-connector-python directly: read with csv.DictReader, then execute INSERT with cursor.executemany(). For a no-code browser solution, use CSVShift.