1MYSQLIMPORT(1)               MySQL 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 SQL statement. Most options to mysqlimport correspond directly to
14       clauses of LOAD DATA syntax. See Section 13.2.7, “LOAD DATA 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] groups of an
28       option file. For information about option files used by MySQL programs,
29       see Section 4.2.7, “Using Option Files”.
30
31       ·   --help, -?
32
33           Display a help message and exit.
34
35       ·   --bind-address=ip_address
36
37           On a computer having multiple network interfaces, use this option
38           to select which interface to use for connecting to the MySQL
39           server.
40
41       ·   --character-sets-dir=dir_name
42
43           The directory where character sets are installed. See
44           Section 10.14, “Character Set Configuration”.
45
46       ·   --columns=column_list, -c column_list
47
48           This option takes a list of comma-separated column names as its
49           value. The order of the column names indicates how to match data
50           file columns with table columns.
51
52       ·   --compress, -C
53
54           Compress all information sent between the client and the server if
55           both support compression.
56
57       ·   --debug[=debug_options], -# [debug_options]
58
59           Write a debugging log. A typical debug_options string is
60           d:t:o,file_name. The default is d:t:o.
61
62       ·   --debug-check
63
64           Print some debugging information when the program exits.
65
66       ·   --debug-info
67
68           Print debugging information and memory and CPU usage statistics
69           when the program exits.
70
71       ·   --default-character-set=charset_name
72
73           Use charset_name as the default character set. See Section 10.14,
74           “Character Set Configuration”.
75
76       ·   --default-auth=plugin
77
78           A hint about the client-side authentication plugin to use. See
79           Section 6.3.10, “Pluggable Authentication”.
80
81       ·   --defaults-extra-file=file_name
82
83           Read this option file after the global option file but (on Unix)
84           before the user option file. If the file does not exist or is
85           otherwise inaccessible, an error occurs.  file_name is interpreted
86           relative to the current directory if given as a relative path name
87           rather than a full path name.
88
89           For additional information about this and other option-file
90           options, see Section 4.2.8, “Command-Line Options that Affect
91           Option-File Handling”.
92
93       ·   --defaults-file=file_name
94
95           Use only the given option file. If the file does not exist or is
96           otherwise inaccessible, an error occurs.  file_name is interpreted
97           relative to the current directory if given as a relative path name
98           rather than a full path name.
99
100           Exception: Even with --defaults-file, client programs read
101           .mylogin.cnf.
102
103           For additional information about this and other option-file
104           options, see Section 4.2.8, “Command-Line Options that Affect
105           Option-File Handling”.
106
107       ·   --defaults-group-suffix=str
108
109           Read not only the usual option groups, but also groups with the
110           usual names and a suffix of str. For example, mysqlimport normally
111           reads the [client] and [mysqlimport] groups. If the
112           --defaults-group-suffix=_other option is given, mysqlimport also
113           reads the [client_other] and [mysqlimport_other] groups.
114
115           For additional information about this and other option-file
116           options, see Section 4.2.8, “Command-Line Options that Affect
117           Option-File Handling”.
118
119       ·   --delete, -D
120
121           Empty the table before importing the text file.
122
123       ·   --enable-cleartext-plugin
124
125           Enable the mysql_clear_password cleartext authentication plugin.
126           (See Section 6.5.1.4, “Client-Side Cleartext Pluggable
127           Authentication”.)
128
129       ·   --fields-terminated-by=..., --fields-enclosed-by=...,
130           --fields-optionally-enclosed-by=..., --fields-escaped-by=...
131
132           These options have the same meaning as the corresponding clauses
133           for LOAD DATA. See Section 13.2.7, “LOAD DATA Syntax”.
134
135       ·   --force, -f
136
137           Ignore errors. For example, if a table for a text file does not
138           exist, continue processing any remaining files. Without --force,
139           mysqlimport exits if a table does not exist.
140
141       ·   --get-server-public-key
142
143           Request from the server the public key required for RSA key
144           pair-based password exchange. This option applies to clients that
145           that authenticate with the caching_sha2_password authentication
146           plugin. For that plugin, the server does not send the public key
147           unless requested. This option is ignored for accounts that do not
148           authenticate with that plugin. It is also ignored if RSA-based
149           password exchange is not used, as is the case when the client
150           connects to the server using a secure connection.
151
152           If --server-public-key-path=file_name is given and specifies a
153           valid public key file, it takes precedence over
154           --get-server-public-key.
155
156           For information about the caching_sha2_password plugin, see
157           Section 6.5.1.3, “Caching SHA-2 Pluggable Authentication”.
158
159       ·   --host=host_name, -h host_name
160
161           Import data to the MySQL server on the given host. The default host
162           is localhost.
163
164       ·   --ignore, -i
165
166           See the description for the --replace option.
167
168       ·   --ignore-lines=N
169
170           Ignore the first N lines of the data file.
171
172       ·   --lines-terminated-by=...
173
174           This option has the same meaning as the corresponding clause for
175           LOAD DATA. For example, to import Windows files that have lines
176           terminated with carriage return/linefeed pairs, use
177           --lines-terminated-by="\r\n". (You might have to double the
178           backslashes, depending on the escaping conventions of your command
179           interpreter.) See Section 13.2.7, “LOAD DATA Syntax”.
180
181       ·   --local, -L
182
183           By default, files are read by the server on the server host. With
184           this option, mysqlimport reads input files locally on the client
185           host. Enabling local data loading also requires that the server
186           permits it; see Section 6.1.6, “Security Issues with LOAD DATA
187           LOCAL”
188
189       ·   --lock-tables, -l
190
191           Lock all tables for writing before processing any text files. This
192           ensures that all tables are synchronized on the server.
193
194       ·   --login-path=name
195
196           Read options from the named login path in the .mylogin.cnf login
197           path file. A “login path” is an option group containing options
198           that specify which MySQL server to connect to and which account to
199           authenticate as. To create or modify a login path file, use the
200           mysql_config_editor utility. See mysql_config_editor(1).
201
202           For additional information about this and other option-file
203           options, see Section 4.2.8, “Command-Line Options that Affect
204           Option-File Handling”.
205
206       ·   --low-priority
207
208           Use LOW_PRIORITY when loading the table. This affects only storage
209           engines that use only table-level locking (such as MyISAM, MEMORY,
210           and MERGE).
211
212       ·   --no-defaults
213
214           Do not read any option files. If program startup fails due to
215           reading unknown options from an option file, --no-defaults can be
216           used to prevent them from being read.
217
218           The exception is that the .mylogin.cnf file, if it exists, is read
219           in all cases. This permits passwords to be specified in a safer way
220           than on the command line even when --no-defaults is used.
221           (.mylogin.cnf is created by the mysql_config_editor utility. See
222           mysql_config_editor(1).)
223
224           For additional information about this and other option-file
225           options, see Section 4.2.8, “Command-Line Options that Affect
226           Option-File Handling”.
227
228       ·   --password[=password], -p[password]
229
230           The password to use when connecting to the server. If you use the
231           short option form (-p), you cannot have a space between the option
232           and the password. If you omit the password value following the
233           --password or -p option on the command line, mysqlimport prompts
234           for one.
235
236           Specifying a password on the command line should be considered
237           insecure. See Section 6.1.2.1, “End-User Guidelines for Password
238           Security”. You can use an option file to avoid giving the password
239           on the command line.
240
241       ·   --pipe, -W
242
243           On Windows, connect to the server using a named pipe. This option
244           applies only if the server supports named-pipe connections.
245
246       ·   --plugin-dir=dir_name
247
248           The directory in which to look for plugins. Specify this option if
249           the --default-auth option is used to specify an authentication
250           plugin but mysqlimport does not find it. See Section 6.3.10,
251           “Pluggable Authentication”.
252
253       ·   --port=port_num, -P port_num
254
255           The TCP/IP port number to use for the connection.
256
257       ·   --print-defaults
258
259           Print the program name and all options that it gets from option
260           files.
261
262           For additional information about this and other option-file
263           options, see Section 4.2.8, “Command-Line Options that Affect
264           Option-File Handling”.
265
266       ·   --protocol={TCP|SOCKET|PIPE|MEMORY}
267
268           The connection protocol to use for connecting to the server. It is
269           useful when the other connection parameters normally would cause a
270           protocol to be used other than the one you want. For details on the
271           permissible values, see Section 4.2.2, “Connecting to the MySQL
272           Server”.
273
274       ·   --replace, -r
275
276           The --replace and --ignore options control handling of input rows
277           that duplicate existing rows on unique key values. If you specify
278           --replace, new rows replace existing rows that have the same unique
279           key value. If you specify --ignore, input rows that duplicate an
280           existing row on a unique key value are skipped. If you do not
281           specify either option, an error occurs when a duplicate key value
282           is found, and the rest of the text file is ignored.
283
284       ·   --secure-auth
285
286           This option was removed in MySQL 8.0.3.
287
288       ·   --server-public-key-path=file_name
289
290           The path name to a file containing a client-side copy of the public
291           key required by the server for RSA key pair-based password
292           exchange. The file must be in PEM format. This option applies to
293           clients that authenticate with the sha256_password or
294           caching_sha2_password authentication plugin. This option is ignored
295           for accounts that do not authenticate with one of those plugins. It
296           is also ignored if RSA-based password exchange is not used, as is
297           the case when the client connects to the server using a secure
298           connection.
299
300           If --server-public-key-path=file_name is given and specifies a
301           valid public key file, it takes precedence over
302           --get-server-public-key.
303
304           For sha256_password, this option applies only if MySQL was built
305           using OpenSSL.
306
307           For information about the sha256_password and caching_sha2_password
308           plugins, see Section 6.5.1.2, “SHA-256 Pluggable Authentication”,
309           and Section 6.5.1.3, “Caching SHA-2 Pluggable Authentication”.
310
311       ·   --shared-memory-base-name=name
312
313           On Windows, the shared-memory name to use, for connections made
314           using shared memory to a local server. The default value is MYSQL.
315           The shared-memory name is case-sensitive.
316
317           The server must be started with the --shared-memory option to
318           enable shared-memory connections.
319
320       ·   --silent, -s
321
322           Silent mode. Produce output only when errors occur.
323
324       ·   --socket=path, -S path
325
326           For connections to localhost, the Unix socket file to use, or, on
327           Windows, the name of the named pipe to use.
328
329       ·   --ssl*
330
331           Options that begin with --ssl specify whether to connect to the
332           server using SSL and indicate where to find SSL keys and
333           certificates. See Section 6.4.2, “Command Options for Encrypted
334           Connections”.
335
336       ·   --ssl-fips-mode={OFF|ON|STRICT} Controls whether to enable FIPS
337           mode on the client side. The --ssl-fips-mode option differs from
338           other --ssl-xxx options in that it is not used to establish
339           encrypted connections, but rather to affect which cryptographic
340           operations are permitted. See Section 6.6, “FIPS Support”.
341
342           These --ssl-fips-mode values are permitted:
343
344           ·   OFF: Disable FIPS mode.
345
346           ·   ON: Enable FIPS mode.
347
348           ·   STRICT: Enable “strict” FIPS mode.
349
350
351               Note
352               If the OpenSSL FIPS Object Module is not available, the only
353               permitted value for --ssl-fips-mode is OFF. In this case,
354               setting --ssl-fips-mode to ON or STRICT causes the client to
355               produce a warning at startup and to operate in non-FIPS mode.
356
357       ·   --tls-ciphersuites=ciphersuite_list
358
359           For client programs, specifies which TLSv1.3 ciphersuites the
360           client permits for encrypted connections. The value is a list of
361           one or more colon-separated ciphersuite names. The ciphersuites
362           that can be named for this option depend on the SSL library used to
363           compile MySQL. For details, see Section 6.4.6, “Encrypted
364           Connection Protocols and Ciphers”.
365
366           This option was added in MySQL 8.0.16.
367
368       ·   --tls-version=protocol_list
369
370           The protocols the client permits for encrypted connections. The
371           value is a list of one or more comma-separated protocol names. The
372           protocols that can be named for this option depend on the SSL
373           library used to compile MySQL. For details, see Section 6.4.6,
374           “Encrypted Connection Protocols and Ciphers”.
375
376       ·   --user=user_name, -u user_name
377
378           The MySQL user name to use when connecting to the server.
379
380       ·   --use-threads=N
381
382           Load files in parallel using N threads.
383
384       ·   --verbose, -v
385
386           Verbose mode. Print more information about what the program does.
387
388       ·   --version, -V
389
390           Display version information and exit.
391
392       Here is a sample session that demonstrates use of mysqlimport:
393
394           shell> mysql -e 'CREATE TABLE imptest(id INT, n VARCHAR(30))' test
395           shell> ed
396           a
397           100     Max Sydow
398           101     Count Dracula
399           .
400           w imptest.txt
401           32
402           q
403           shell> od -c imptest.txt
404           0000000   1   0   0  \t   M   a   x       S   y   d   o   w  \n   1   0
405           0000020   1  \t   C   o   u   n   t       D   r   a   c   u   l   a  \n
406           0000040
407           shell> mysqlimport --local test imptest.txt
408           test.imptest: Records: 2  Deleted: 0  Skipped: 0  Warnings: 0
409           shell> mysql -e 'SELECT * FROM imptest' test
410           +------+---------------+
411           | id   | n             |
412           +------+---------------+
413           |  100 | Max Sydow     |
414           |  101 | Count Dracula |
415           +------+---------------+
416
418       Copyright © 1997, 2019, Oracle and/or its affiliates. All rights
419       reserved.
420
421       This documentation is free software; you can redistribute it and/or
422       modify it only under the terms of the GNU General Public License as
423       published by the Free Software Foundation; version 2 of the License.
424
425       This documentation is distributed in the hope that it will be useful,
426       but WITHOUT ANY WARRANTY; without even the implied warranty of
427       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
428       General Public License for more details.
429
430       You should have received a copy of the GNU General Public License along
431       with the program; if not, write to the Free Software Foundation, Inc.,
432       51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see
433       http://www.gnu.org/licenses/.
434
435

SEE ALSO

437       For more information, please refer to the MySQL Reference Manual, which
438       may already be installed locally and which is also available online at
439       http://dev.mysql.com/doc/.
440

AUTHOR

442       Oracle Corporation (http://dev.mysql.com/).
443
444
445
446MySQL 8.0                         02/20/2019                    MYSQLIMPORT(1)
Impressum