Skip to content
Guide · HeidiSQL

How to Import CSV in HeidiSQL

HeidiSQL imports CSV and other delimited text files through Tools > Import CSV file, which opens the Import text file dialog. You choose the file and encoding, describe the format (field terminator, encloser, line terminator), map columns to a target table, and pick whether the server or HeidiSQL parses the file. This guide walks through each option as the help page and the dialog's source code define it.

Steps and facts checked 8 October 2026 against the vendor's official documentation. Versions covered: HeidiSQL 12.21; MySQL 8.4 for LOAD DATA LOCAL behaviour. Next review due April 2027. Menus, shortcuts and prices change between releases; check the vendor's documentation for your version.
Short answer
  • Menu path: Tools > Import CSV file. The dialog is titled Import text file and accepts .csv and .txt files.
  • Set Encoding explicitly: HeidiSQL warns that auto detection is highly discouraged and can cause data loss.
  • On MariaDB and MySQL you can let the server parse the file (LOAD DATA LOCAL INFILE) or let HeidiSQL parse it and send INSERTs; for other engines only client parsing and plain INSERT are available.
  • Choosing the New table entry at the end of the Table list opens Detect CSV layout, which scans the file and creates a table for you.
  • If MySQL answers with error 3950 (local data loading disabled), switch the method to Client parses file contents or enable local_infile on the server.
How we know: Research-based: steps and options were checked against the HeidiSQL help page and the import dialog source code (loaddata.dfm, loaddata.pas, csv_detector.dfm) in the official GitHub repository, and LOAD DATA LOCAL behaviour against the MySQL 8.4 Reference Manual, on 8 October 2026. We have not run an import for this guide, and no sample file is provided.

HeidiSQL import CSV: step by step

The help page describes a CSV file as a text file with data rows for one table, imported via Tools > Import CSV file, where you tell HeidiSQL the format (line terminator, enclosing character and so on). The dialog that opens is called Import text file:

  1. Connect to the server and select the target database in the tree.
  2. Choose Tools > Import CSV file.
  3. In Input file, pick the Filename (the file dialog offers CSV files, Text files and All files) and set Encoding, for example UTF-8.
  4. Under Control characters, set Fields terminated by (comma, semicolon or tab), Fields enclosed by (usually a double quote, with the optionally box), Fields escaped by and Lines terminated by.
  5. Under Options, use Ignore first 1 lines if the file has a header row.
  6. Under Destination, choose Database and Table, then tick and order the Columns to match the file with the Up and Down buttons.
  7. Choose the Method and Handling of duplicate rows (below) and click the import button.

When you pick a file, HeidiSQL shows a warning if encoding is still on auto detect: "Auto detecting the encoding of a file is highly discouraged. You may experience data loss if the detection fails."

Import options explained

With server parsing, HeidiSQL builds a LOAD DATA LOCAL INFILE statement, so the file is read by the client library and sent to the server. Encoding, the escape character and the optional encloser apply only to server parsing; the dialog disables them when you choose client parsing. Client parsing reads the file in HeidiSQL and sends INSERT statements, which works on every engine but is usually slower for large files.

Options in the Import text file dialog
OptionValuesNotes
MethodServer parses file contents (LOAD DATA); Client parses file contentsServer parsing is MariaDB and MySQL only
Handling of duplicate rowsINSERT (may throw errors); INSERT IGNORE (duplicates); REPLACE (duplicates)IGNORE and REPLACE are MariaDB and MySQL only
Low priority, avoid high server loadOn or offAdds LOW_PRIORITY; MariaDB and MySQL only
Input file contains local formatted numbersOn or offFor numbers such as 1.234,56 (German format)
Truncate destination table before importOn or offEmpties the table first
Keep dialog open after importOn or offUseful for several files

Importing into a new table

The table must exist before rows can be loaded, but HeidiSQL can create it. At the end of the Table list is <New table>. Selecting it opens the Detect CSV layout dialog: click Scan file... so HeidiSQL reads the file and proposes a table definition, review the column names and types, then click Ok, create table. The new table is selected as the destination and you continue with the import. Check the proposed types before creating the table, especially for dates, decimals and long text.

MySQL, PostgreSQL, SQL Server and SQLite

The import dialog source code disables MySQL-only features when the active connection is not MySQL or MariaDB: the method switches to Client parses file contents, duplicate handling to plain INSERT, and Low priority is unavailable. So on PostgreSQL, SQL Server and SQLite the import works as a client-side INSERT loader. For very large files on those engines, a server-side bulk loader (for example PostgreSQL's COPY or SQL Server's BULK INSERT) is usually the better tool.

Fixing common CSV import problems

  • ERROR 3950: Loading local data is disabled. MySQL requires local data loading to be enabled on both the client and the server, and the local_infile server variable is off by default. Either switch to Client parses file contents, or ask the administrator to enable local_infile.
  • No rows were imported. HeidiSQL lists the usual causes: the file is empty, the wrong encoding was selected or detected, or the field and line terminators do not match the file.
  • Garbled accents. Re-import with the correct Encoding rather than auto detect.
  • Numbers like 1.234,56 load wrongly. Tick Input file contains local formatted numbers.
  • Duplicate key errors. Choose INSERT IGNORE or REPLACE on MySQL, or clean the data first.

Frequently asked questions

Where is the CSV import in HeidiSQL?

Tools > Import CSV file. It opens the Import text file dialog, which also handles tab-delimited text files.

Can HeidiSQL create the table from a CSV file?

Yes. Choose <New table> in the Table list; the Detect CSV layout dialog scans the file and creates a table when you click Ok, create table.

Why does HeidiSQL say loading local data is disabled?

That is MySQL error 3950: server-side parsing uses LOAD DATA LOCAL, which must be enabled on client and server. Use Client parses file contents instead, or enable local_infile.

Can I import CSV into PostgreSQL or SQL Server with HeidiSQL?

Yes, with client parsing and plain INSERT; the LOAD DATA method and duplicate handling options are MySQL and MariaDB only.

How do I import a .sql file instead?

Use File > Run SQL file, and select the file's encoding explicitly, as the help page advises.

Sources

Checked 8 October 2026.

How we research tool guides: our editorial method. CodeWithSQL earns nothing from the vendors mentioned.

Still choosing a SQL client?

Read the full reviews, or compare tools side by side.