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