mysqlimport - A MySQL Data Import Program

The mysqlimport client comes with a command-line interface that helps with the LOAD DATA SQL statement. Most options to mysqlimport respond directly to clauses of LOAD DATA syntax

Invoking mysqlimport

The utility mysqlimport can be invoked as shown below −

shell> mysqlimport [options] db_name textfile1 [textfile2 ...]

For every text file that is named on the command line, mysqlimport strips any extension from the file name and uses the result to figure out the name of the table into which the file's contents have to be imported.


Let us take an example: Files named sample.txt, sample.text, and sample all would be imported into a table named sample.

This utlity supports the following options, which can be specified on the command line or in the [mysqlimport] and [client] groups of an option file.


If the computer has multiple network interfaces, this option can be used to select which interface needs to be used to connect to the MySQL server.


It is the directory where character sets are installed.

--columns=column_list, -c column_list

It takes a list of comma-separated column names as its value. The order of the column names indicate how data file columns have to be matched with the table columns.

--compress, -C

It compresses all information sent between the client and the server if possible.


It refers to the permitted compression algorithms for connections to the server. The available algorithms are the same as that for the protocol_compression_algorithms system variable. The default value is uncompressed.


It enables the mysql_clear_password cleartext authentication plugin.

--force, -f

This option ignores the errors. Let us take an example: If a table for a text file does not exist, continue processing the remaining files. Without --force, mysqlimport exits if a table does not exist.