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-lines=N
108
109 Ignore the first N lines of the data file.
110
111 · --lines-terminated-by=...
112
113 This option has the same meaning as the corresponding clause for
114 LOAD DATA INFILE. For example, to import Windows files that have
115 lines terminated with carriage return/linefeed pairs, use
116 --lines-terminated-by="\r\n". (You might have to double the
117 backslashes, depending on the escaping conventions of your command
118 interpreter.).
119
120 · --local, -L
121
122 Read input files locally from the client host.
123
124 · --lock-tables, -l
125
126 Lock all tables for writing before processing any text files. This
127 ensures that all tables are synchronized on the server.
128
129 · --low-priority
130
131 Use LOW_PRIORITY when loading the table. This affects only storage
132 engines that use only table-level locking (such as MyISAM, MEMORY,
133 and MERGE).
134
135 · --no-defaults
136
137 Do not read default options from any option file. This must be
138 given as the first argument.
139
140 · --password[=password], -p[password]
141
142 The password to use when connecting to the server. If you use the
143 short option form (-p), you cannot have a space between the option
144 and the password. If you omit the password value following the
145 --password or -p option on the command line, mysqlimport prompts
146 for one.
147
148 Specifying a password on the command line should be considered
149 insecure. You can use an option file to avoid giving the password
150 on the command line.
151
152 · --pipe, -W
153
154 On Windows, connect to the server via a named pipe. This option
155 applies only if the server supports named-pipe connections.
156
157 · --plugin-dir=name
158
159 Directory for client-side plugins.
160
161 · --port=port_num, -P port_num
162
163 The TCP/IP port number to use for the connection.
164
165 · --protocol={TCP|SOCKET|PIPE|MEMORY}
166
167 The connection protocol to use for connecting to the server. It is
168 useful when the other connection parameters normally would cause a
169 protocol to be used other than the one you want.
170
171 · --print-defaults
172
173 Print the program argument list and exit. This must be given as
174 the first argument.
175
176 · --replace, -r
177
178 The --replace and --ignore options control handling of input rows
179 that duplicate existing rows on unique key values. If you specify
180 --replace, new rows replace existing rows that have the same unique
181 key value. If you specify --ignore, input rows that duplicate an
182 existing row on a unique key value are skipped. If you do not
183 specify either option, an error occurs when a duplicate key value
184 is found, and the rest of the text file is ignored.
185
186 · --silent, -s
187
188 Silent mode. Produce output only when errors occur.
189
190 · --socket=path, -S path
191
192 For connections to localhost, the Unix socket file to use, or, on
193 Windows, the name of the named pipe to use.
194
195 · --ssl
196
197 Enable SSL for connection (automatically enabled with other flags).
198 Disable with --skip-ssl.
199
200 · --ssl-ca=name
201
202 CA file in PEM format (check OpenSSL docs, implies --ssl).
203
204 · --ssl-capath=name
205
206 CA directory (check OpenSSL docs, implies --ssl).
207
208 · --ssl-cert=name
209
210 X509 cert in PEM format (check OpenSSL docs, implies --ssl).
211
212 · --ssl-cipher=name
213
214 SSL cipher to use (check OpenSSL docs, implies --ssl).
215
216 · --ssl-key=name
217
218 X509 key in PEM format (check OpenSSL docs, implies --ssl).
219
220 · --ssl-crl=name
221
222 Certificate revocation list (check OpenSSL docs, implies --ssl).
223
224 · --ssl-crlpath=name
225
226 Certificate revocation list path (check OpenSSL docs, implies
227 --ssl).
228
229 · --ssl-verify-server-cert
230
231 Verify server's "Common Name" in its cert against hostname used
232 when connecting. This option is disabled by default.
233
234 · --user=user_name, -u user_name
235
236 The MariaDB user name to use when connecting to the server.
237
238 · --use-threads=N
239
240 Load files in parallel using N threads.
241
242 · --verbose, -v
243
244 Verbose mode. Print more information about what the program does.
245
246 · --version, -V
247
248 Display version information and exit.
249
250 Here is a sample session that demonstrates use of mysqlimport:
251
252 shell> mysql -e ´CREATE TABLE imptest(id INT, n VARCHAR(30))´ test
253 shell> ed
254 a
255 100 Max Sydow
256 101 Count Dracula
257 .
258 w imptest.txt
259 32
260 q
261 shell> od -c imptest.txt
262 0000000 1 0 0 \t M a x S y d o w \n 1 0
263 0000020 1 \t C o u n t D r a c u l a \n
264 0000040
265 shell> mysqlimport --local test imptest.txt
266 test.imptest: Records: 2 Deleted: 0 Skipped: 0 Warnings: 0
267 shell> mysql -e ´SELECT * FROM imptest´ test
268 +------+---------------+
269 | id | n |
270 +------+---------------+
271 | 100 | Max Sydow |
272 | 101 | Count Dracula |
273 +------+---------------+
274
276 Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc.,
277 2010-2015 MariaDB Foundation
278
279 This documentation is free software; you can redistribute it and/or
280 modify it only under the terms of the GNU General Public License as
281 published by the Free Software Foundation; version 2 of the License.
282
283 This documentation is distributed in the hope that it will be useful,
284 but WITHOUT ANY WARRANTY; without even the implied warranty of
285 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
286 General Public License for more details.
287
288 You should have received a copy of the GNU General Public License along
289 with the program; if not, write to the Free Software Foundation, Inc.,
290 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see
291 http://www.gnu.org/licenses/.
292
293
295 For more information, please refer to the MariaDB Knowledge Base,
296 available online at https://mariadb.com/kb/
297
299 MariaDB Foundation (http://www.mariadb.org/).
300
301
302
303MariaDB 10.3 9 May 2017 MYSQLIMPORT(1)