MYSQLIMPORT(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 2.5, “LOAD
15       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 filename 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:
28
29       ·  --help, -?
30
31          Display a help message and exit.
32
33       ·  --character-sets-dir=path
34
35          The directory where character sets are installed. See Section 8.1,
36          “The Character Set Used for Data and Sorting”.
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. The debug_options string often is
52          ´d:t:o,file_name'.
53
54       ·  --default-character-set=charset_name
55
56          Use charset_name as the default character set. See Section 8.1, “The
57          Character Set Used for Data and Sorting”.
58
59       ·  --delete, -D
60
61          Empty the table before importing the text file.
62
63       ·  --fields-terminated-by=..., --fields-enclosed-by=...,
64          --fields-optionally-enclosed-by=..., --fields-escaped-by=...
65
66          These options have the same meaning as the corresponding clauses for
67          LOAD DATA INFILE. See Section 2.5, “LOAD DATA INFILE Syntax”.
68
69       ·  --force, -f
70
71          Ignore errors. For example, if a table for a text file does not
72          exist, continue processing any remaining files. Without --force,
73          mysqlimport exits if a table does not exist.
74
75       ·  --host=host_name, -h host_name
76
77          Import data to the MySQL server on the given host. The default host
78          is localhost.
79
80       ·  --ignore, -i
81
82          See the description for the --replace option.
83
84       ·  --ignore-lines=N
85
86          Ignore the first N lines of the data file.
87
88       ·  --lines-terminated-by=...
89
90          This option has the same meaning as the corresponding clause for
91          LOAD DATA INFILE. For example, to import Windows files that have
92          lines terminated with carriage return/linefeed pairs, use
93          --lines-terminated-by="\r\n". (You might have to double the
94          backslashes, depending on the escaping conventions of your command
95          interpreter.) See Section 2.5, “LOAD DATA INFILE Syntax”.
96
97       ·  --local, -L
98
99          Read input files locally from the client host.
100
101       MySQL Enterprise. For expert advice on the security implications of
102       enabling LOCAL, subscribe to the MySQL Network Monitoring and Advisory
103       Service. For more information see
104       http://www.mysql.com/products/enterprise/advisors.html.
105
106       ·  --lock-tables, -l
107
108          Lock all tables for writing before processing any text files. This
109          ensures that all tables are synchronized on the server.
110
111       ·  --low-priority
112
113          Use LOW_PRIORITY when loading the table. This affects only storage
114          engines that use only table-level locking (MyISAM, MEMORY, MERGE).
115
116       ·  --password[=password], -p[password]
117
118          The password to use when connecting to the server. If you use the
119          short option form (-p), you cannot have a space between the option
120          and the password. If you omit the password value following the
121          --password or -p option on the command line, you are prompted for
122          one.
123
124          Specifying a password on the command line should be considered
125          insecure. See Section 6.6, “Keeping Your Password Secure”.
126
127       ·  --port=port_num, -P port_num
128
129          The TCP/IP port number to use for the connection.
130
131       ·  --protocol={TCP|SOCKET|PIPE|MEMORY}
132
133          The connection protocol to use.
134
135       ·  --replace, -r
136
137          The --replace and --ignore options control handling of input rows
138          that duplicate existing rows on unique key values. If you specify
139          --replace, new rows replace existing rows that have the same unique
140          key value. If you specify --ignore, input rows that duplicate an
141          existing row on a unique key value are skipped. If you do not
142          specify either option, an error occurs when a duplicate key value is
143          found, and the rest of the text file is ignored.
144
145       ·  --silent, -s
146
147          Silent mode. Produce output only when errors occur.
148
149       ·  --socket=path, -S path
150
151          For connections to localhost, the Unix socket file to use, or, on
152          Windows, the name of the named pipe to use.
153
154       ·  --ssl*
155
156          Options that begin with --ssl specify whether to connect to the
157          server via SSL and indicate where to find SSL keys and certificates.
158          See Section 6.7.3, “SSL Command Options”.
159
160       ·  --user=user_name, -u user_name
161
162          The MySQL username to use when connecting to the server.
163
164       ·  --verbose, -v
165
166          Verbose mode. Print more information about what the program does.
167
168       ·  --version, -V
169
170          Display version information and exit.
171
172
173       Here is a sample session that demonstrates use of mysqlimport:
174
175          shell> mysql -e 'CREATE TABLE imptest(id INT, n VARCHAR(30))' test
176          shell> ed
177          a
178          100     Max Sydow
179          101     Count Dracula
180          w imptest.txt
181          32
182          q
183          shell> od -c imptest.txt
184          0000000   1   0   0  \t   M   a   x       S   y   d   o   w  \n   1   0
185          0000020   1  \t   C   o   u   n   t       D   r   a   c   u   l   a  \n
186          0000040
187          shell> mysqlimport --local test imptest.txt
188          test.imptest: Records: 2  Deleted: 0  Skipped: 0  Warnings: 0
189          shell> mysql -e 'SELECT * FROM imptest' test
190          +------+---------------+
191          | id   | n             |
192          +------+---------------+
193          |  100 | Max Sydow     |
194          |  101 | Count Dracula |
195          +------+---------------+
196
198       Copyright 1997-2007 MySQL AB
199
200       This documentation is NOT distributed under a GPL license. Use of this
201       documentation is subject to the following terms: You may create a
202       printed copy of this documentation solely for your own personal use.
203       Conversion to other formats is allowed as long as the actual content is
204       not altered or edited in any way. You shall not publish or distribute
205       this documentation in any form or on any media, except if you
206       distribute the documentation in a manner similar to how MySQL
207       disseminates it (that is, electronically for download on a Web site
208       with the software) or on a CD-ROM or similar medium, provided however
209       that the documentation is disseminated together with the software on
210       the same medium. Any other use, such as any dissemination of printed
211       copies or use of this documentation, in whole or in part, in another
212       publication, requires the prior written consent from an authorized
213       representative of MySQL AB. MySQL AB reserves any and all rights to
214       this documentation not expressly granted above.
215
216       Please email <docs@mysql.com> for more information.
217

SEE ALSO

219       For more information, please refer to the MySQL Reference Manual, which
220       may already be installed locally and which is also available online at
221       http://dev.mysql.com/doc/.
222

AUTHOR

224       MySQL AB (http://www.mysql.com/).  This software comes with no
225       warranty.
226
227
228
229MySQL 5.0                         07/04/2007                    MYSQLIMPORT(1)
Impressum