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