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