In this tutorial, we will learn some common mysqlimport options. The mysqlimport program loads tables from text files in various formats. The name of the text file must be the name of the database table that should be used for import.
By default, the input files for mysqlimport are assumed to contain lines terminated by new lines, with each line containing tab-separated data values. This is the same default format for the LOAD DATA INFILE statement.
We can invoke mysqlimport with the – – help option to see a complete list of the options.
Some of the common options are as follows:
|–fields-terminated-by=string||Specifies the delimiter between data values within input lines. The default is \t(tab character)|
|–fields-enclosed-by=char||Use if values are quoted-common value for char is the double quote character (‘”‘)|
|–lines-terminated-by=string||Specifies character sequence that each input line ends with. The default is \n|
|–ignore or –replace||Handling of input records that contain unique key values that are already present in the table|
|–local||Allows use of a data file that’s located locally on the client host|
Some examples follow which load an input file named Country.txt into the Country database
table in the world MySQL database.
–lines-terminated-by=”\n” world Country.txt
mysqlimport –fields-enclosed-by='”‘ world Country.txt
MySQL Tutorials on this website:
For more information on MySQL Database: