---
title: "Convert CSV to MySQL"
description: "Convert CSV files to SQL for MySQL in your browser: a CREATE TABLE with typed columns, then INSERT statements. Free, and your file is never uploaded."
canonical: https://intosql.com/csv-to-mysql
last_updated: 2026-10-15
---

# Convert CSV to MySQL

Drop your CSV file to get a MySQL script with CREATE TABLE and INSERT statements. Each column gets a type, and every fix is listed with its row and column.

## From CSV to MySQL, column by column

The sample above, ventas_2024.csv, as IntoSQL writes it for MySQL: what each column holds in the file, the type it gets and how its first value lands in the script.

| In the file | First value | Column | MySQL type | In the script |
| --- | --- | --- | --- | --- |
| Folio | `00412` | `folio` | `varchar(8)` | `'00412'` |
| Cliente | `Peña Muñoz` | `cliente` | `varchar(16)` | `'Peña Muñoz'` |
| Ciudad | `Mérida` | `ciudad` | `varchar(16)` | `'Mérida'` |
| Fecha | `15/02/2024` | `fecha` | `date` | `'2024-02-15'` |
| Importe | `1.234,50` | `importe` | `decimal(6,2)` | `1234.50` |
| Pagado | `sí` | `pagado` | `tinyint(1)` | `TRUE` |

## Load the script into MySQL

The download is a plain .sql file. Run it with MySQL's own tools.

### MySQL

```shell
mysql --default-character-set=utf8mb4 mydb < ventas_2024.mysql.sql
```

The script sets utf8mb4 itself; the flag makes the client send it the same way, so accents arrive intact. In MySQL Workbench, choose File, Run SQL Script, and pick the file.

Without a script:

```shell
intosql load ventas_2024.csv --into mysql://user@localhost/mydb
```

## What IntoSQL reads in CSV files

- The encoding is detected, Windows-1252 and UTF-16 included, so accents and ñ arrive intact.
- The separator is detected: comma, semicolon, tab or vertical bar. With a semicolon, decimal commas like 1.234,50 are read as numbers.
- Quoted values can hold separators and line breaks.

## What to know about MySQL

- Yes and no values become tinyint(1). Text up to 255 characters is varchar; longer text is text, mediumtext or longtext by size.
- The script uses utf8mb4 and sets the SQL mode, so accents, emoji, backslashes and line breaks load as written.
- MySQL's datetime stores no time zone.

### How each kind of value is stored in MySQL

| Value | MySQL |
| --- | --- |
| Yes and no | `tinyint(1)` |
| Whole numbers | `int` |
| Large whole numbers | `bigint` |
| Decimals | `decimal(p,s) · double` |
| Floating-point numbers | `double` |
| Dates | `date` |
| Times of day | `time(6) · time` |
| Dates with a time | `datetime(6) · datetime` |
| Dates with a time and offset | `datetime(6) · datetime` |
| Text | `varchar(n) · text · mediumtext · longtext` |

## Questions about CSV to MySQL

### How do I convert CSV to MySQL?

Drop your file on the converter at the top of this page. It finds the header, reads every value and writes the MySQL script, listing each fix it made. Download the script and run it with the mysql client.

### What if my CSV uses semicolons or tabs?

The separator is detected: comma, semicolon, tab or vertical bar. You can also set it under More options. With a semicolon, decimal commas such as 1.234,50 are read as numbers.

### Which MySQL types does it use?

Yes and no values become tinyint(1), whole numbers int, decimals decimal(p,s), dates date, dates with a time datetime(6) and text varchar(n). Sizes come from the longest value in each column.

### Does it keep leading zeros in MySQL?

Yes. A code such as 00412 stays text, so MySQL stores it as varchar(8) and the script writes it as '00412'.

### Can it load the data into MySQL without a script?

Yes, with IntoSQL Pro. The desktop app and the command line connect to MySQL and load the rows straight in, creating the table first.

### How big can the CSV file be?

The browser reads a CSV as it streams in, so files of several gigabytes work. On an Apple M4 laptop the command line converts a 174 MB CSV of a million rows in under a second.

## CSV into other databases

- [Convert CSV to SQL](https://intosql.com/csv-to-sql)
- [Convert CSV to PostgreSQL](https://intosql.com/csv-to-postgresql)
- [Convert CSV to MariaDB](https://intosql.com/csv-to-mariadb)
- [Convert CSV to SQLite](https://intosql.com/csv-to-sqlite)
- [Convert CSV to SQL Server](https://intosql.com/csv-to-sql-server)
- [Convert CSV to Oracle](https://intosql.com/csv-to-oracle)

## Other files into MySQL

- [Convert Excel to MySQL](https://intosql.com/excel-to-mysql)
- [Convert JSON to MySQL](https://intosql.com/json-to-mysql)
