The mysqlimport utility is a bulk loader for reading the contents of text files into existing tables. It functions as a command-line interface to the LOAD DATA SQL statement, and is an efficient way to enter rows into tables.
mysqlimport [options] db_name file_name …
The db_name argument specifies the database that contains the tables into which you want to load data. The tables to load are determined from the filename arguments. For each filename, any extension from the first period in the name is stripped off and the remaining basename is used as the name of the table into which the file should be loaded. For example, mysqlimport will load the contents of president.txt into the president table.
--compress --host --port --user --debug --password --silent --verbose --help --pipe --socket --version
The following options control how mysqlimport processes input files. The next section, "Data Format Options," describes options that may be used to indicate the format of the data in the input files.
-d, --delete
-f, --force
-i, --ignore
When an input row contains a value for a unique key that already exists in the table, keeps the existing row and discards the input row.
-L, --local
By default, mysqlimport lets the server read the data file, which means that the file must be located on the server host and that you must have the FILE privilege. Specifying the --local option tells mysqlimport to read the data file itself and send it to the server. This is slower but works when you're running mysqlimport on a different machine than the server host, as well as on the server host—even if you don't have the FILE privilege.
The --local option was introduced in MySQL 3.22.15.
-l, --lock-tables
-r, --replace
When an input row contains a value for a unique key that already exists in the table, replaces the existing row with the input row.
By default, mysqlimport assumes that data files contain newline-terminated lines consisting of tab-separated values. The expected format may be altered using the following options. You may need to enclose the option value in appropriate quoting characters. These options are analogous to the data format options for the LOAD DATA statement. See the entry for LOAD DATA in Appendix D.
--fields-enclosed-by=char
Specifies that column values are enclosed within the given character, usually a quote character. By default, values are assumed to not be enclosed by any character.
--fields-escaped-by=char
Specifies the escape character used to escape special characters. The default is no escape character.
--fields-optionally-enclosed-by=char
Specifies that column values may be enclosed within the given character, usually a quote character.
--fields-terminated-by=char
Specifies the character that separates column values. By default, values are assumed to be separated by tabs.
--lines-terminated-by=str
Specifies the string (it may be multiple characters) that terminates input lines. By default, lines are assumed to be terminated by newline characters.