mysqlimport — a data import program

Synopsis

mysqlimport [options] db_name textfile1 ...

Description

The mysqlimport client provides a command-line interface to the LOAD DATA INFILE SQL statement. Most options to mysqlimport correspond directly to clauses of LOAD DATA INFILE syntax.

Invoke mysqlimport like this:

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

For each text file named on the command line, mysqlimport strips any extension from the file name and uses the result to determine the name of the table into which to import the file´s contents. For example, files named patient.txt, patient.text, and patient all would be imported into a table named patient.

mysqldump supports the following options, which can be specified on the command line or in the [mysqldump] and [client] option file groups. mysqldump also supports the options for processing option files.

Here is a sample session that demonstrates use of mysqlimport:

shell> mysql -e ´CREATE TABLE imptest(id INT, n VARCHAR(30))´ test
shell> ed
a
100     Max Sydow
101     Count Dracula
.
w imptest.txt
32
q
shell> od -c imptest.txt
0000000   1   0   0  \t   M   a   x       S   y   d   o   w  \n   1   0
0000020   1  \t   C   o   u   n   t       D   r   a   c   u   l   a  \n
0000040
shell> mysqlimport --local test imptest.txt
test.imptest: Records: 2  Deleted: 0  Skipped: 0  Warnings: 0
shell> mysql -e ´SELECT * FROM imptest´ test
+------+---------------+
| id   | n             |
+------+---------------+
|  100 | Max Sydow     |
|  101 | Count Dracula |
+------+---------------+

See Also

For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/

Author

MariaDB Foundation (http://www.mariadb.org/).

Info

21 May 2019 MariaDB 10.3 MariaDB Database System