1MYSQLIMPORT(1)              MariaDB Database System             MYSQLIMPORT(1)
2
3
4

NAME

6       mysqlimport - a data import program
7

SYNOPSIS

9       mysqlimport [options] db_name textfile1 ...
10

DESCRIPTION

12       The mysqlimport client provides a command-line interface to the LOAD
13       DATA INFILE SQL statement. Most options to mysqlimport correspond
14       directly to clauses of LOAD DATA INFILE syntax.
15
16       Invoke mysqlimport like this:
17
18           shell> mysqlimport [options] db_name textfile1 [textfile2 ...]
19
20       For each text file named on the command line, mysqlimport strips any
21       extension from the file name and uses the result to determine the name
22       of the table into which to import the file´s contents. For example,
23       files named patient.txt, patient.text, and patient all would be
24       imported into a table named patient.
25
26       mysqlimport supports the following options, which can be specified on
27       the command line or in the [mysqlimport] and [client] option file
28       groups.  mysqlimport also supports the options for processing option
29       files.
30
31       ·   --help, -?
32
33           Display a help message and exit.
34
35       ·   --character-sets-dir=path
36
37           The directory where character sets are installed.
38
39       ·   --columns=column_list, -c column_list
40
41           This option takes a comma-separated list of column names as its
42           value. The order of the column names indicates how to match data
43           file columns with table columns.
44
45       ·   --compress, -C
46
47           Compress all information sent between the client and the server if
48           both support compression.
49
50       ·   --debug[=debug_options], -# [debug_options]
51
52           Write a debugging log. A typical debug_options string is
53           ´d:t:o,file_name´. The default is ´d:t:o´.
54
55       ·   --debug-check
56
57           Print some debugging information when the program exits.
58
59       ·   --debug-info
60
61           Print debugging information and memory and CPU usage statistics
62           when the program exits.
63
64       ·   --default-auth=plugin_name
65
66           Default authentication client-side plugin to use.
67
68       ·   --default-character-set=charset_name
69
70           Use charset_name as the default character set.
71
72       ·   --defaults-extra-file=filename
73
74           Set filename as the file to read default options from after the
75           global defaults files has been read.  Must be given as first
76           option.
77
78       ·   --defaults-file=filename
79
80           Set filename as the file to read default options from, override
81           global defaults files.  Must be given as first option.
82
83       ·   --delete, -d
84
85           Empty the table before importing the text file.
86
87       ·   --fields-terminated-by=..., --fields-enclosed-by=...,
88           --fields-optionally-enclosed-by=..., --fields-escaped-by=...
89
90           These options have the same meaning as the corresponding clauses
91           for LOAD DATA INFILE.
92
93       ·   --force, -f
94
95           Ignore errors. For example, if a table for a text file does not
96           exist, continue processing any remaining files. Without --force,
97           mysqlimport exits if a table does not exist.
98
99       ·   --host=host_name, -h host_name
100
101           Import data to the MariaDB server on the given host. The default
102           host is localhost.
103
104       ·   --ignore, -i
105
106           See the description for the --replace option.
107
108       ·   --ignore-foreign-keys, -k
109
110           Disable foreign key checks while importing the data.
111
112       ·   --ignore-lines=N
113
114           Ignore the first N lines of the data file.
115
116       ·   --lines-terminated-by=...
117
118           This option has the same meaning as the corresponding clause for
119           LOAD DATA INFILE. For example, to import Windows files that have
120           lines terminated with carriage return/linefeed pairs, use
121           --lines-terminated-by="\r\n". (You might have to double the
122           backslashes, depending on the escaping conventions of your command
123           interpreter.).
124
125       ·   --local, -L
126
127           Read input files locally from the client host.
128
129       ·   --lock-tables, -l
130
131           Lock all tables for writing before processing any text files. This
132           ensures that all tables are synchronized on the server.
133
134       ·   --low-priority
135
136           Use LOW_PRIORITY when loading the table. This affects only storage
137           engines that use only table-level locking (such as MyISAM, MEMORY,
138           and MERGE).
139
140       ·   --no-defaults
141
142           Do not read default options from any option file. This must be
143           given as the first argument.
144
145       ·   --password[=password], -p[password]
146
147           The password to use when connecting to the server. If you use the
148           short option form (-p), you cannot have a space between the option
149           and the password. If you omit the password value following the
150           --password or -p option on the command line, mysqlimport prompts
151           for one.
152
153           Specifying a password on the command line should be considered
154           insecure. You can use an option file to avoid giving the password
155           on the command line.
156
157       ·   --pipe, -W
158
159           On Windows, connect to the server via a named pipe. This option
160           applies only if the server supports named-pipe connections.
161
162       ·   --plugin-dir=name
163
164            Directory for client-side plugins.
165
166       ·   --port=port_num, -P port_num
167
168           The TCP/IP port number to use for the connection.
169
170       ·   --protocol={TCP|SOCKET|PIPE|MEMORY}
171
172           The connection protocol to use for connecting to the server. It is
173           useful when the other connection parameters normally would cause a
174           protocol to be used other than the one you want.
175
176       ·   --print-defaults
177
178           Print the program argument list and exit.  This must be given as
179           the first argument.
180
181       ·   --replace, -r
182
183           The --replace and --ignore options control handling of input rows
184           that duplicate existing rows on unique key values. If you specify
185           --replace, new rows replace existing rows that have the same unique
186           key value. If you specify --ignore, input rows that duplicate an
187           existing row on a unique key value are skipped. If you do not
188           specify either option, an error occurs when a duplicate key value
189           is found, and the rest of the text file is ignored.
190
191       ·   --silent, -s
192
193           Silent mode. Produce output only when errors occur.
194
195       ·   --socket=path, -S path
196
197           For connections to localhost, the Unix socket file to use, or, on
198           Windows, the name of the named pipe to use.
199
200       ·   --ssl
201
202           Enable SSL for connection (automatically enabled with other flags).
203           Disable with --skip-ssl.
204
205       ·   --ssl-ca=name
206
207           CA file in PEM format (check OpenSSL docs, implies --ssl).
208
209       ·   --ssl-capath=name
210
211           CA directory (check OpenSSL docs, implies --ssl).
212
213       ·   --ssl-cert=name
214
215           X509 cert in PEM format (check OpenSSL docs, implies --ssl).
216
217       ·   --ssl-cipher=name
218
219           SSL cipher to use (check OpenSSL docs, implies --ssl).
220
221       ·   --ssl-key=name
222
223           X509 key in PEM format (check OpenSSL docs, implies --ssl).
224
225       ·   --ssl-crl=name
226
227           Certificate revocation list (check OpenSSL docs, implies --ssl).
228
229       ·   --ssl-crlpath=name
230
231           Certificate revocation list path (check OpenSSL docs, implies
232           --ssl).
233
234       ·   --ssl-verify-server-cert
235
236           Verify server's "Common Name" in its cert against hostname used
237           when connecting. This option is disabled by default.
238
239       ·   --user=user_name, -u user_name
240
241           The MariaDB user name to use when connecting to the server.
242
243       ·   --use-threads=N
244
245           Load files in parallel using N threads.
246
247       ·   --verbose, -v
248
249           Verbose mode. Print more information about what the program does.
250
251       ·   --version, -V
252
253           Display version information and exit.
254
255       Here is a sample session that demonstrates use of mysqlimport:
256
257           shell> mysql -e ´CREATE TABLE imptest(id INT, n VARCHAR(30))´ test
258           shell> ed
259           a
260           100     Max Sydow
261           101     Count Dracula
262           .
263           w imptest.txt
264           32
265           q
266           shell> od -c imptest.txt
267           0000000   1   0   0  \t   M   a   x       S   y   d   o   w  \n   1   0
268           0000020   1  \t   C   o   u   n   t       D   r   a   c   u   l   a  \n
269           0000040
270           shell> mysqlimport --local test imptest.txt
271           test.imptest: Records: 2  Deleted: 0  Skipped: 0  Warnings: 0
272           shell> mysql -e ´SELECT * FROM imptest´ test
273           +------+---------------+
274           | id   | n             |
275           +------+---------------+
276           |  100 | Max Sydow     |
277           |  101 | Count Dracula |
278           +------+---------------+
279
281       Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc.,
282       2010-2015 MariaDB Foundation
283
284       This documentation is free software; you can redistribute it and/or
285       modify it only under the terms of the GNU General Public License as
286       published by the Free Software Foundation; version 2 of the License.
287
288       This documentation is distributed in the hope that it will be useful,
289       but WITHOUT ANY WARRANTY; without even the implied warranty of
290       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
291       General Public License for more details.
292
293       You should have received a copy of the GNU General Public License along
294       with the program; if not, write to the Free Software Foundation, Inc.,
295       51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA or see
296       http://www.gnu.org/licenses/.
297
298

SEE ALSO

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

AUTHOR

304       MariaDB Foundation (http://www.mariadb.org/).
305
306
307
308MariaDB 10.4                      21 May 2019                   MYSQLIMPORT(1)
Impressum