Site icon TestingDocs.com

Import Data Using MySQLImport Utility

Overview

In this tutorial, we will learn about mysqlimport utility. The mysqlimport client program loads data
into database tables in various formats. It provides a command line interface to the LOAD DATA INFILE statement.

https://www.testingdocs.com/mysql-load-data-infile-statement/

MySQLImport

mysqlimport connects to the MySQL server and, for each input file, issues a LOAD DATA INFILE statement that loads the file into the appropriate database table. Each table to be loaded by mysqlimport must already exist, and each input file should contain only data values. By default, input files for mysqlimport are assumed to contain lines terminated by newlines, with each line containing tab-separated data values. This is the same default format assumed by the LOAD DATA INFILE statement.

Help options

Invoke mysqlimport with the –help option to see a complete list of the options. To know the command line options of mysqlimport program.

>mysqlimport –help

Usage

The mysqlimport examines the options given on the command line. We can invoke the mysqlimport from the command line as follows:

> mysqlimport [OPTIONS] database_name  input_textfile…

 

The database_name is the database containing the table to be loaded and the input_file is the file that contains the data to be loaded. We can provide several input files following the database name.

The mysqlimport command uses each filename to determine the name of the corresponding target database table into which the file’s contents should be loaded. The program strips
the filename extension and uses the result as the table name.

For example, mysqlimport treats a file named Actor.txt as input to be loaded into a database table
named Actor. After determining the table name corresponding to the filename, the mysqlimport issues
a LOAD DATA INFILE statement to load the file into the corresponding database table.

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