~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to client/drizzleimport.1

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-03-18 12:12:31 UTC
  • Revision ID: james.westby@ubuntu.com-20100318121231-k6g1xe6cshbwa0f8
Tags: upstream-2010.03.1347
ImportĀ upstreamĀ versionĀ 2010.03.1347

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
.\"     Title: \fBmysqlimport\fR
 
2
.\"    Author: 
 
3
.\" Generator: DocBook XSL Stylesheets v1.70.1 <http://docbook.sf.net/>
 
4
.\"      Date: 05/23/2009
 
5
.\"    Manual: MySQL Database System
 
6
.\"    Source: MySQL 6.0
 
7
.\"
 
8
.TH "\fBMYSQLIMPORT\fR" "1" "05/23/2009" "MySQL 6.0" "MySQL Database System"
 
9
.\" disable hyphenation
 
10
.nh
 
11
.\" disable justification (adjust text to left margin only)
 
12
.ad l
 
13
.SH "NAME"
 
14
mysqlimport \- a data import program
 
15
.SH "SYNOPSIS"
 
16
.HP 44
 
17
\fBmysqlimport [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR\fB \fR\fB\fItextfile1\fR\fR\fB ...\fR
 
18
.SH "DESCRIPTION"
 
19
.PP
 
20
The
 
21
\fBmysqlimport\fR
 
22
client provides a command\-line interface to the
 
23
LOAD DATA INFILE
 
24
SQL statement. Most options to
 
25
\fBmysqlimport\fR
 
26
correspond directly to clauses of
 
27
LOAD DATA INFILE
 
28
syntax. See
 
29
Section\ 12.2.6, \(lqLOAD DATA INFILE Syntax\(rq.
 
30
.PP
 
31
Invoke
 
32
\fBmysqlimport\fR
 
33
like this:
 
34
.sp
 
35
.RS 3n
 
36
.nf
 
37
shell> \fBmysqlimport [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR\fB \fR\fB\fItextfile1\fR\fR\fB [\fR\fB\fItextfile2\fR\fR\fB ...]\fR
 
38
.fi
 
39
.RE
 
40
.PP
 
41
For each text file named on the command line,
 
42
\fBmysqlimport\fR
 
43
strips any extension from the file name and uses the result to determine the name of the table into which to import the file's contents. For example, files named
 
44
\fIpatient.txt\fR,
 
45
\fIpatient.text\fR, and
 
46
\fIpatient\fR
 
47
all would be imported into a table named
 
48
patient.
 
49
.PP
 
50
\fBmysqlimport\fR
 
51
supports the options in the following list. It also reads option files and supports the options for processing them described at
 
52
Section\ 4.2.3.2.1, \(lqCommand\-Line Options that Affect Option\-File Handling\(rq.
 
53
.TP 3n
 
54
\(bu
 
55
\fB\-\-help\fR,
 
56
\fB\-?\fR
 
57
.sp
 
58
Display a help message and exit.
 
59
.TP 3n
 
60
\(bu
 
61
\fB\-\-character\-sets\-dir=\fR\fB\fIpath\fR\fR
 
62
.sp
 
63
The directory where character sets are installed. See
 
64
Section\ 9.2, \(lqThe Character Set Used for Data and Sorting\(rq.
 
65
.TP 3n
 
66
\(bu
 
67
\fB\-\-columns=\fR\fB\fIcolumn_list\fR\fR,
 
68
\fB\-c \fR\fB\fIcolumn_list\fR\fR
 
69
.sp
 
70
This option takes a comma\-separated list of column names as its value. The order of the column names indicates how to match data file columns with table columns.
 
71
.TP 3n
 
72
\(bu
 
73
\fB\-\-compress\fR,
 
74
\fB\-C\fR
 
75
.sp
 
76
Compress all information sent between the client and the server if both support compression.
 
77
.TP 3n
 
78
\(bu
 
79
\fB\-\-debug[=\fR\fB\fIdebug_options\fR\fR\fB]\fR,
 
80
\fB\-# [\fR\fB\fIdebug_options\fR\fR\fB]\fR
 
81
.sp
 
82
Write a debugging log. A typical
 
83
\fIdebug_options\fR
 
84
string is
 
85
\'d:t:o,\fIfile_name\fR'. The default is
 
86
\'d:t:o'.
 
87
.TP 3n
 
88
\(bu
 
89
\fB\-\-debug\-check\fR
 
90
.sp
 
91
Print some debugging information when the program exits.
 
92
.TP 3n
 
93
\(bu
 
94
\fB\-\-debug\-info\fR
 
95
.sp
 
96
Print debugging information and memory and CPU usage statistics when the program exits.
 
97
.TP 3n
 
98
\(bu
 
99
\fB\-\-default\-character\-set=\fR\fB\fIcharset_name\fR\fR
 
100
.sp
 
101
Use
 
102
\fIcharset_name\fR
 
103
as the default character set. See
 
104
Section\ 9.2, \(lqThe Character Set Used for Data and Sorting\(rq.
 
105
.TP 3n
 
106
\(bu
 
107
\fB\-\-delete\fR,
 
108
\fB\-D\fR
 
109
.sp
 
110
Empty the table before importing the text file.
 
111
.TP 3n
 
112
\(bu
 
113
\fB\-\-fields\-terminated\-by=...\fR,
 
114
\fB\-\-fields\-enclosed\-by=...\fR,
 
115
\fB\-\-fields\-optionally\-enclosed\-by=...\fR,
 
116
\fB\-\-fields\-escaped\-by=...\fR
 
117
.sp
 
118
These options have the same meaning as the corresponding clauses for
 
119
LOAD DATA INFILE. See
 
120
Section\ 12.2.6, \(lqLOAD DATA INFILE Syntax\(rq.
 
121
.TP 3n
 
122
\(bu
 
123
\fB\-\-force\fR,
 
124
\fB\-f\fR
 
125
.sp
 
126
Ignore errors. For example, if a table for a text file does not exist, continue processing any remaining files. Without
 
127
\fB\-\-force\fR,
 
128
\fBmysqlimport\fR
 
129
exits if a table does not exist.
 
130
.TP 3n
 
131
\(bu
 
132
\fB\-\-host=\fR\fB\fIhost_name\fR\fR,
 
133
\fB\-h \fR\fB\fIhost_name\fR\fR
 
134
.sp
 
135
Import data to the MySQL server on the given host. The default host is
 
136
localhost.
 
137
.TP 3n
 
138
\(bu
 
139
\fB\-\-ignore\fR,
 
140
\fB\-i\fR
 
141
.sp
 
142
See the description for the
 
143
\fB\-\-replace\fR
 
144
option.
 
145
.TP 3n
 
146
\(bu
 
147
\fB\-\-ignore\-lines=\fR\fB\fIN\fR\fR
 
148
.sp
 
149
Ignore the first
 
150
\fIN\fR
 
151
lines of the data file.
 
152
.TP 3n
 
153
\(bu
 
154
\fB\-\-lines\-terminated\-by=...\fR
 
155
.sp
 
156
This option has the same meaning as the corresponding clause for
 
157
LOAD DATA INFILE. For example, to import Windows files that have lines terminated with carriage return/linefeed pairs, use
 
158
\fB\-\-lines\-terminated\-by="\\r\\n"\fR. (You might have to double the backslashes, depending on the escaping conventions of your command interpreter.) See
 
159
Section\ 12.2.6, \(lqLOAD DATA INFILE Syntax\(rq.
 
160
.TP 3n
 
161
\(bu
 
162
\fB\-\-local\fR,
 
163
\fB\-L\fR
 
164
.sp
 
165
Read input files locally from the client host.
 
166
.TP 3n
 
167
\(bu
 
168
\fB\-\-lock\-tables\fR,
 
169
\fB\-l\fR
 
170
.sp
 
171
Lock
 
172
\fIall\fR
 
173
tables for writing before processing any text files. This ensures that all tables are synchronized on the server.
 
174
.TP 3n
 
175
\(bu
 
176
\fB\-\-low\-priority\fR
 
177
.sp
 
178
Use
 
179
LOW_PRIORITY
 
180
when loading the table. This affects only storage engines that use only table\-level locking (MyISAM,
 
181
MEMORY,
 
182
MERGE).
 
183
.TP 3n
 
184
\(bu
 
185
\fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR,
 
186
\fB\-p[\fR\fB\fIpassword\fR\fR\fB]\fR
 
187
.sp
 
188
The password to use when connecting to the server. If you use the short option form (\fB\-p\fR), you
 
189
\fIcannot\fR
 
190
have a space between the option and the password. If you omit the
 
191
\fIpassword\fR
 
192
value following the
 
193
\fB\-\-password\fR
 
194
or
 
195
\fB\-p\fR
 
196
option on the command line, you are prompted for one.
 
197
.sp
 
198
Specifying a password on the command line should be considered insecure. See
 
199
Section\ 5.5.6.2, \(lqEnd\-User Guidelines for Password Security\(rq.
 
200
.TP 3n
 
201
\(bu
 
202
\fB\-\-pipe\fR,
 
203
\fB\-W\fR
 
204
.sp
 
205
On Windows, connect to the server via a named pipe. This option applies only for connections to a local server, and only if the server supports named\-pipe connections.
 
206
.TP 3n
 
207
\(bu
 
208
\fB\-\-port=\fR\fB\fIport_num\fR\fR,
 
209
\fB\-P \fR\fB\fIport_num\fR\fR
 
210
.sp
 
211
The TCP/IP port number to use for the connection.
 
212
.TP 3n
 
213
\(bu
 
214
\fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR
 
215
.sp
 
216
The connection protocol to use for connecting to the server. It is useful when the other connection parameters normally would cause a protocol to be used other than the one you want. For details on the allowable values, see
 
217
Section\ 4.2.2, \(lqConnecting to the MySQL Server\(rq.
 
218
.TP 3n
 
219
\(bu
 
220
\fB\-\-replace\fR,
 
221
\fB\-r\fR
 
222
.sp
 
223
The
 
224
\fB\-\-replace\fR
 
225
and
 
226
\fB\-\-ignore\fR
 
227
options control handling of input rows that duplicate existing rows on unique key values. If you specify
 
228
\fB\-\-replace\fR, new rows replace existing rows that have the same unique key value. If you specify
 
229
\fB\-\-ignore\fR, input rows that duplicate an existing row on a unique key value are skipped. If you do not specify either option, an error occurs when a duplicate key value is found, and the rest of the text file is ignored.
 
230
.TP 3n
 
231
\(bu
 
232
\fB\-\-silent\fR,
 
233
\fB\-s\fR
 
234
.sp
 
235
Silent mode. Produce output only when errors occur.
 
236
.TP 3n
 
237
\(bu
 
238
\fB\-\-socket=\fR\fB\fIpath\fR\fR,
 
239
\fB\-S \fR\fB\fIpath\fR\fR
 
240
.sp
 
241
For connections to
 
242
localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use.
 
243
.TP 3n
 
244
\(bu
 
245
\fB\-\-ssl*\fR
 
246
.sp
 
247
Options that begin with
 
248
\fB\-\-ssl\fR
 
249
specify whether to connect to the server via SSL and indicate where to find SSL keys and certificates. See
 
250
Section\ 5.5.7.3, \(lqSSL Command Options\(rq.
 
251
.TP 3n
 
252
\(bu
 
253
\fB\-\-user=\fR\fB\fIuser_name\fR\fR,
 
254
\fB\-u \fR\fB\fIuser_name\fR\fR
 
255
.sp
 
256
The MySQL user name to use when connecting to the server.
 
257
.TP 3n
 
258
\(bu
 
259
\fB\-\-use\-threads=\fR\fB\fIN\fR\fR
 
260
.sp
 
261
Load files in parallel using
 
262
\fIN\fR
 
263
threads.
 
264
.TP 3n
 
265
\(bu
 
266
\fB\-\-verbose\fR,
 
267
\fB\-v\fR
 
268
.sp
 
269
Verbose mode. Print more information about what the program does.
 
270
.TP 3n
 
271
\(bu
 
272
\fB\-\-version\fR,
 
273
\fB\-V\fR
 
274
.sp
 
275
Display version information and exit.
 
276
.sp
 
277
.RE
 
278
.PP
 
279
Here is a sample session that demonstrates use of
 
280
\fBmysqlimport\fR:
 
281
.sp
 
282
.RS 3n
 
283
.nf
 
284
shell> \fBmysql \-e 'CREATE TABLE imptest(id INT, n VARCHAR(30))' test\fR
 
285
shell> \fBed\fR
 
286
a
 
287
100     Max Sydow
 
288
101     Count Dracula
 
289
.
 
290
w imptest.txt
 
291
32
 
292
q
 
293
shell> \fBod \-c imptest.txt\fR
 
294
0000000   1   0   0  \\t   M   a   x       S   y   d   o   w  \\n   1   0
 
295
0000020   1  \\t   C   o   u   n   t       D   r   a   c   u   l   a  \\n
 
296
0000040
 
297
shell> \fBmysqlimport \-\-local test imptest.txt\fR
 
298
test.imptest: Records: 2  Deleted: 0  Skipped: 0  Warnings: 0
 
299
shell> \fBmysql \-e 'SELECT * FROM imptest' test\fR
 
300
+\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
 
301
| id   | n             |
 
302
+\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
 
303
|  100 | Max Sydow     |
 
304
|  101 | Count Dracula |
 
305
+\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+
 
306
.fi
 
307
.RE
 
308
.SH "COPYRIGHT"
 
309
.PP
 
310
Copyright 2007\-2008 MySQL AB, 2009 Sun Microsystems, Inc.
 
311
.PP
 
312
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
 
313
.PP
 
314
This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 
315
.PP
 
316
You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110\-1301 USA or see http://www.gnu.org/licenses/.
 
317
.SH "SEE ALSO"
 
318
For more information, please refer to the MySQL Reference Manual,
 
319
which may already be installed locally and which is also available
 
320
online at http://dev.mysql.com/doc/.
 
321
.SH AUTHOR
 
322
Sun Microsystems, Inc. (http://www.mysql.com/).