1MYSQLIMPORT(1)               MySQL Database System              MYSQLIMPORT(1)
2
3
4

NAME

6       mysqlimport - a data import program
7

SYNOPSIS

9       mysqlimport [options] db_name textfile1 ...
10

DESCRIPTION

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. See Section 13.2.6,
15       “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] groups of an
29       option file.  mysqlimport also supports the options for processing
30       option files described at Section 4.2.3.4, “Command-Line Options that
31       Affect Option-File Handling”.
32
33       ·   --help, -?
34
35           Display a help message and exit.
36
37       ·   --bind-address=ip_address
38
39           On a computer having multiple network interfaces, this option can
40           be used to select which interface is employed when connecting to
41           the MySQL server.
42
43           This option is supported only in the version of mysqlimport that is
44           supplied with MySQL Cluster, beginning with MySQL Cluster NDB
45           6.3.4. It is not available in standard MySQL 5.1 releases.
46
47       ·   --character-sets-dir=path
48
49           The directory where character sets are installed. See Section 10.5,
50           “Character Set Configuration”.
51
52       ·   --columns=column_list, -c column_list
53
54           This option takes a comma-separated list of column names as its
55           value. The order of the column names indicates how to match data
56           file columns with table columns.
57
58       ·   --compress, -C
59
60           Compress all information sent between the client and the server if
61           both support compression.
62
63       ·   --debug[=debug_options], -# [debug_options]
64
65           Write a debugging log. A typical debug_options string is
66           'd:t:o,file_name'. The default is 'd:t:o'.
67
68       ·   --debug-check
69
70           Print some debugging information when the program exits. This
71           option was added in MySQL 5.1.21.
72
73       ·   --debug-info
74
75           Print debugging information and memory and CPU usage statistics
76           when the program exits. This option was added in MySQL 5.1.14.
77
78       ·   --default-character-set=charset_name
79
80           Use charset_name as the default character set. See Section 10.5,
81           “Character Set Configuration”.
82
83           Some options, such as --opt, automatically enable --lock-tables. If
84           you want to override this, use --skip-lock-tables at the end of the
85           option list.
86
87       ·   --delete, -D
88
89           Empty the table before importing the text file.
90
91       ·   --fields-terminated-by=..., --fields-enclosed-by=...,
92           --fields-optionally-enclosed-by=..., --fields-escaped-by=...
93
94           These options have the same meaning as the corresponding clauses
95           for LOAD DATA INFILE. See Section 13.2.6, “LOAD DATA INFILE
96           Syntax”.
97
98       ·   --force, -f
99
100           Ignore errors. For example, if a table for a text file does not
101           exist, continue processing any remaining files. Without --force,
102           mysqlimport exits if a table does not exist.
103
104       ·   --host=host_name, -h host_name
105
106           Import data to the MySQL server on the given host. The default host
107           is localhost.
108
109       ·   --ignore, -i
110
111           See the description for the --replace option.
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.) See Section 13.2.6, “LOAD DATA INFILE Syntax”.
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       ·   --password[=password], -p[password]
142
143           The password to use when connecting to the server. If you use the
144           short option form (-p), you cannot have a space between the option
145           and the password. If you omit the password value following the
146           --password or -p option on the command line, mysqlimport prompts
147           for one.
148
149           Specifying a password on the command line should be considered
150           insecure. See Section 6.1.2.1, “End-User Guidelines for Password
151           Security”. You can use an option file to avoid giving the password
152           on the command line.
153
154       ·   --pipe, -W
155
156           On Windows, connect to the server using a named pipe. This option
157           applies only if the server supports named-pipe connections.
158
159       ·   --port=port_num, -P port_num
160
161           The TCP/IP port number to use for the connection.
162
163       ·   --protocol={TCP|SOCKET|PIPE|MEMORY}
164
165           The connection protocol to use for connecting to the server. It is
166           useful when the other connection parameters normally would cause a
167           protocol to be used other than the one you want. For details on the
168           permissible values, see Section 4.2.2, “Connecting to the MySQL
169           Server”.
170
171       ·   --replace, -r
172
173           The --replace and --ignore options control handling of input rows
174           that duplicate existing rows on unique key values. If you specify
175           --replace, new rows replace existing rows that have the same unique
176           key value. If you specify --ignore, input rows that duplicate an
177           existing row on a unique key value are skipped. If you do not
178           specify either option, an error occurs when a duplicate key value
179           is found, and the rest of the text file is ignored.
180
181       ·   --silent, -s
182
183           Silent mode. Produce output only when errors occur.
184
185       ·   --socket=path, -S path
186
187           For connections to localhost, the Unix socket file to use, or, on
188           Windows, the name of the named pipe to use.
189
190       ·   --ssl*
191
192           Options that begin with --ssl specify whether to connect to the
193           server using SSL and indicate where to find SSL keys and
194           certificates. See Section 6.3.6.4, “SSL Command Options”.
195
196       ·   --user=user_name, -u user_name
197
198           The MySQL user name to use when connecting to the server.
199
200       ·   --use-threads=N
201
202           Load files in parallel using N threads. This option was added in
203           MySQL 5.1.7.
204
205       ·   --verbose, -v
206
207           Verbose mode. Print more information about what the program does.
208
209       ·   --version, -V
210
211           Display version information and exit.
212
213       Here is a sample session that demonstrates use of mysqlimport:
214
215           shell> mysql -e 'CREATE TABLE imptest(id INT, n VARCHAR(30))' test
216           shell> ed
217           a
218           100     Max Sydow
219           101     Count Dracula
220           .
221           w imptest.txt
222           32
223           q
224           shell> od -c imptest.txt
225           0000000   1   0   0  \t   M   a   x       S   y   d   o   w  \n   1   0
226           0000020   1  \t   C   o   u   n   t       D   r   a   c   u   l   a  \n
227           0000040
228           shell> mysqlimport --local test imptest.txt
229           test.imptest: Records: 2  Deleted: 0  Skipped: 0  Warnings: 0
230           shell> mysql -e 'SELECT * FROM imptest' test
231           +------+---------------+
232           | id   | n             |
233           +------+---------------+
234           |  100 | Max Sydow     |
235           |  101 | Count Dracula |
236           +------+---------------+
237
239       Copyright © 1997, 2013, Oracle and/or its affiliates. All rights
240       reserved.
241
242       This documentation is free software; you can redistribute it and/or
243       modify it only under the terms of the GNU General Public License as
244       published by the Free Software Foundation; version 2 of the License.
245
246       This documentation is distributed in the hope that it will be useful,
247       but WITHOUT ANY WARRANTY; without even the implied warranty of
248       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
249       General Public License for more details.
250
251       You should have received a copy of the GNU General Public License along
252       with the program; if not, write to the Free Software Foundation, Inc.,
253       51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see
254       http://www.gnu.org/licenses/.
255
256

SEE ALSO

258       For more information, please refer to the MySQL Reference Manual, which
259       may already be installed locally and which is also available online at
260       http://dev.mysql.com/doc/.
261

AUTHOR

263       Oracle Corporation (http://dev.mysql.com/).
264
265
266
267MySQL 5.1                         11/04/2013                    MYSQLIMPORT(1)
Impressum