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

SEE ALSO

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

AUTHOR

262       Oracle Corporation (http://dev.mysql.com/).
263
264
265
266MySQL 5.1                         10/26/2011                    MYSQLIMPORT(1)
Impressum