Want to import data from CSV file to MySQL via Command Line?
Using FileToDB, a native GUI tool, you can import data from CSV file to MySQL (MariaDB, Percona) via Command Line easily and fast.
Support Windows, Linux, macOS.
Support large CSV files (big than 4GB).
Support multiple CSV file encodings: ANSI, UTF-8, UTF-8BOM, UCS-2LE (Unicode Little Endian), UCS-2BE (Unicode Big Endian), CP1250 (Central European), CP1251 (Cyrillic), CP1252 (Western European), CP1253 (Greek), CP1254 (Turkish ), CP1255 (Hebrew), CP1256 (Arabic), CP1257 (Baltic), CP1258 (Vietnamese), CP437 (United States), CP850 (Western European), CP852 (Central European), CP866 (Cyrillic), CP874 (Thai), CP932 (Japanese), CP936 (Chinese Simplified), CP949 (Korean), CP950 (Chinese Traditional), ISO-8859-1 (Western European), ISO-8859-2 (Central European), ISO-8859-15 (Latin 9), KOI-8 (Cyrillic), Macintosh (Western European).
Here’s how to.
Example of importing CSV to MySQL (MariaDB, Percona)
Example source CSV file

After converting, data in MySQL table

Import data from CSV file to MySQL (MariaDB, Percona)
Please download and install FileToDB, then run it.
Choose MySQL and logon.

Click “Wizard – 1 File To 1 Table” at task dialog.

Select the “CSV” file type.

then show the wizard.
1. Open a CSV file.

2. Select a MySQL table and config fields.

3. Preview data.

4. Import CSV data to MySQL.

View imported data in MySQL table

Save/load session of importing CSV to MySQL (MariaDB, Percona)
You can save/load session to run “CSV to MySQL” conversion repeatly.
1.Save Session.
Click “Save Session” button, then enter a session file name.

click “OK” button.
2.Load Session.
Click the “Open a Saved Session” in task window, select a session file.

then show the wizard form, click a few “Next” to import CSV to MySQL.

Run in command line for importing CSV to MySQL (MariaDB, Percona)
You can run “CSV to MySQL” conversion in command line.
When you save session, you can click “Save & Make Batch File”.

The “Save & Make Batch File” form shows.

Click “OK” button, you’ll create a batch file, in Windows, like this:
C: cd "C:\Users\pansh\AppData\Local\Programs\FileToDB" FileToDB task="C:\Users\pansh\Documents\test.ldr" logfile="C:\Users\pansh\Documents\test.log"
You can run this batch file in command line.
Run as scheduled task for importing CSV to MySQL (MariaDB, Percona)
You can run “CSV to MySQL” conversion automatically at specific time.
On Linux/macOS, you can use Crontab.
For macOS, How to Fix Cron Permission Issues in macOS.
On Windows, in “Save & Make Batch File” form, you can click “Create & Schedule Task” to set a scheduled task.

And then, with scheduled task wizard, step by step.





You’ll see created task listed in scheduled task list.

Download
Here you can download FileToDB, and buy FileToDB.
CSV → MySQL reference
Type mapping
| Value kind | in CSV | in MySQL |
|---|---|---|
| Int | 1234 | INT |
| Bigint | 9007199254740993 | BIGINT |
| Decimal | 1234.56 | DECIMAL(p,s) |
| Float | 1.234e+10 | DOUBLE |
| Text | quoted only when it contains a comma or a quote | VARCHAR(n) |
| Long text | must be quoted; line breaks inside force multi-line records | LONGTEXT |
| Date | 2026-09-18 | DATE |
| Datetime | 2026-09-18 14:30:00 | DATETIME |
| Binary | not representable - base64 or hex string | LONGBLOB |
| Boolean | TRUE / FALSE, or 1 / 0 depending on the writer | TINYINT(1) |
| JSON | the whole JSON value quoted, with internal quotes doubled | JSON |
Dialect differences
CSV is a file format and MySQL is a database server, so the target has to be told the types the file never carried – the rows below are where the two sides diverge.
| Property | in CSV | in MySQL |
|---|---|---|
| port | — | 3306 |
| identifiers | Double quotes; a literal quote is doubled ("" ) | `backtick` |
| row limit | — | LIMIT n |
| dates | Conventional text: 2026-09-18 or 2026-09-18 14:30:00 | DATETIME, TIMESTAMP, DATE, TIME |
| long text | — | TINYTEXT / TEXT / MEDIUMTEXT / LONGTEXT |
| binary | Not supported | BLOB / TINYBLOB / LONGBLOB |
| separator | Comma "," | — |
| encoding | No declaration - UTF-8 works only with a BOM | — |
| typing | None - every field is text | — |
| shape | Flat table, optional header row | Tables of rows and columns |
| ceiling | No formal limit; row count bounded by memory | — |
Command line
| Side | Command |
|---|---|
| MySQL | mysqldump, or mysql -e "SELECT ..." > out.csv |
| MySQL (load) | mysqlimport, or LOAD DATA INFILE |
Convert your data online, free
Free in-browser converters for CSV, Excel, JSON, XML and SQL: Withdata Online Data Conversion. Large files, batch conversion or scheduling? See the offline desktop apps, or browse all data conversion tools.
