Site icon TestingDocs.com

MySQLImport Options

Overview

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.

https://www.testingdocs.com/import-data-with-mysqlimport-utility/

Options

We can invoke mysqlimport with the  – – help option to see a complete list of the options.

Some of the common options are as follows:

 

Option Description
–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

 

Examples

Some examples follow which load an input file named Country.txt into the Country database
table in the world MySQL database.

mysqlimport –fields-terminated-by=”,”
–lines-terminated-by=”\n” world Country.txt

mysqlimport –fields-enclosed-by='”‘ world Country.txt

MySQL Tutorials

MySQL Tutorials on this website:

https://www.testingdocs.com/mysql-tutorials-for-beginners/

For more information on MySQL Database:

https://www.mysql.com/

Exit mobile version