.TH "MYSQLDBIMPORT" "1" "May 09, 2012" "1.0.3" "MySQL Utilities" .SH NAME mysqldbimport \- Import object definitions or data into a database . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .\" Man page generated from reStructeredText. . .SH SYNOPSIS .sp .nf .ft C mysqldbimport [options] import_file ... .ft P .fi .SH DESCRIPTION .sp This utility imports metadata (object definitions) or data or both for one or more databases from one or more files. .sp If an object exists on the destination server with the same name as an imported object, it is dropped first before importing the new object. .sp To skip objects by type, use the \fI\-\-skip\fP option with a list of the objects to skip. This enables you to extract a particular set of objects, say, for importing only events (by excluding all other types). Similarly, to skip creation of \fBUPDATE\fP statements for \fBBLOB\fP data, specify the \fI\%--skip-blobs\fP option. .sp To specify the input format, use one of the following values with the \fI\-\-format\fP option. These correspond to the output formats of the \fBmysqldbexport\fP utility: .INDENT 0.0 .TP .B \fBsql\fP (default) Input consists of SQL statements. For definitions, this consists of the appropriate \fBCREATE\fP and \fBGRANT\fP statements. For data, this is an \fBINSERT\fP statement (or bulk insert if the \fI\%--bulk-insert\fP option is specified). .TP .B \fBgrid\fP Display output in grid or table format like that of the \fBmysql\fP monitor. .TP .B \fBcsv\fP Input is formatted in comma\-separated values format. .TP .B \fBtab\fP Input is formatted in tab\-separated format. .TP .B \fBvertical\fP Display output in single\-column format like that of the \fB\eG\fP command for the \fBmysql\fP monitor. .UNINDENT .sp To indicate that input in \fBcsv\fP or \fBtab\fP format does not contain column headers, specify the \fI\-\-no\-headers\fP option. .sp To turn off all feedback information, specify the \fI\-\-quiet\fP option. .sp By default, the utility creates each table on the destination server using the same storage engine as the original table. To override this and specify the storage engine to use for all tables created on the destination server, use the \fI\%--new-storage-engine\fP option. If the destination server supports the new engine, all tables use that engine. .sp To specify the storage engine to use for tables for which the destination server does not support the original storage engine on the source server, use the \fI\%--default-storage-engine\fP option. .sp The \fI\%--new-storage-engine\fP option takes precedence over \fI\%--default-storage-engine\fP if both are given. .sp If the \fI\%--new-storage-engine\fP or \fI\%--default-storage-engine\fP option is given and the destination server does not support the specified storage engine, a warning is issued and the server\(aqs default storage engine setting is used instead. .sp You must provide connection parameters (user, host, password, and so forth) for an account that has the appropriate privileges to access all objects in the operation. For details, see \fI\%NOTES\fP. .SH OPTIONS .sp \fBmysqldbimport\fP accepts the following command\-line options: .INDENT 0.0 .TP .B \-\-help Display a help message and exit. .UNINDENT .INDENT 0.0 .TP .B \-\-bulk\-insert, \-b Use bulk insert statements for data. .UNINDENT .INDENT 0.0 .TP .B \-\-default\-storage\-engine= The engine to use for tables if the destination server does not support the original storage engine on the source server. .UNINDENT .INDENT 0.0 .TP .B \-\-drop\-first, \-d Drop each database to be imported if exists before importing anything into it. .UNINDENT .INDENT 0.0 .TP .B \-\-dryrun Import the files and generate the statements but do not execute them. This is useful for testing input file validity. .UNINDENT .INDENT 0.0 .TP .B \-\-format=, \-f Specify the input format. Permitted format values are \fBsql\fP, \fBgrid\fP, \fBtab\fP, \fBcsv\fP, and \fBvertical\fP. The default is \fBsql\fP. .UNINDENT .INDENT 0.0 .TP .B \-\-import=, \-i Specify the import format. Permitted format values are \fBdefinitions\fP = import only the definitions (metadata) for the objects in the database list, \fBdata\fP = import only the table data for the tables in the database list, and \fBboth\fP = import the definitions and the data. The default is \fBdefinitions\fP. .sp If you attempt to import objects into an existing database, the result depends on the import format. If the format is \fBdefinitions\fP or \fBboth\fP, an error occurs unless \fI\%--drop-first\fP is given. If the format is \fBdata\fP, imported table data is added to existing table data. .UNINDENT .INDENT 0.0 .TP .B \-\-new\-storage\-engine= The engine to use for all tables created on the destination server. .UNINDENT .INDENT 0.0 .TP .B \-\-no\-headers, \-h Input does not contain column headers. This option applies only for \fBcsv\fP and \fBtab\fP output. .UNINDENT .INDENT 0.0 .TP .B \-\-quiet, \-q Turn off all messages for quiet execution. .UNINDENT .INDENT 0.0 .TP .B \-\-server= Connection information for the server in <\fIuser\fP>[:<\fIpasswd\fP>]@<\fIhost\fP>[:<\fIport\fP>][:<\fIsocket\fP>] format. .UNINDENT .INDENT 0.0 .TP .B \-\-skip= Specify objects to skip in the operation as a comma\-separated list (no spaces). Permitted values are \fBCREATE_DB\fP, \fBDATA\fP, \fBEVENTS\fP, \fBFUNCTIONS\fP, \fBGRANTS\fP, \fBPROCEDURES\fP, \fBTABLES\fP, \fBTRIGGERS\fP, and \fBVIEWS\fP. .UNINDENT .INDENT 0.0 .TP .B \-\-skip\-blobs Do not import \fBBLOB\fP data. .UNINDENT .INDENT 0.0 .TP .B \-\-skip\-rpl Do not execute replication commands. .UNINDENT .INDENT 0.0 .TP .B \-\-verbose, \-v Specify how much information to display. Use this option multiple times to increase the amount of information. For example, \fI\-v\fP = verbose, \fI\-vv\fP = more verbose, \fI\-vvv\fP = debug. .UNINDENT .INDENT 0.0 .TP .B \-\-version Display version information and exit. .UNINDENT .SH NOTES .sp The login user must have the appropriate permissions to create new objects, access (read) the \fBmysql\fP database, and grant privileges. If a database to be imported already exists, the user must have read permission for it, which is needed to check the existence of objects in the database. .sp Actual privileges needed may differ from installation to installation depending on the security privileges present and whether the database contains certain objects such as views or events and whether binary logging is enabled. .sp Some combinations of the options may result in errors during the operation. For example, excluding tables but not views may result in an error when a view is imported. .sp The \fI\%--new-storage-engine\fP and \fI\%--default-storage-engine\fP options apply to all destination tables in the operation. .sp For the \fI\-\-format\fP and \fI\%--import\fP options, the permitted values are not case sensitive. In addition, values may be specified as any unambiguous prefix of a valid value. For example, \fI\-\-format=g\fP specifies the grid format. An error occurs if a prefix matches more than one valid value. .SH EXAMPLES .sp To import the metadata from the \fButil_test\fP database to the server on the local host using a file in CSV format, use this command: .sp .nf .ft C $ mysqldbimport \-\-server=root@localhost \-\-import=definitions \e \-\-format=csv data.csv # Source on localhost: ... connected. # Importing definitions from data.csv. #...done. .ft P .fi .sp Similarly, to import the data from the \fButil_test\fP database to the server on the local host, importing the data using bulk insert statements, use this command: .sp .nf .ft C $ mysqldbimport \-\-server=root@localhost \-\-import=data \e \-\-bulk\-insert \-\-format=csv data.csv # Source on localhost: ... connected. # Importing data from data.csv. #...done. .ft P .fi .sp To import both data and definitions from the \fButil_test\fP database, importing the data using bulk insert statements from a file that contains SQL statements, use this command: .sp .nf .ft C $ mysqldbimport \-\-server=root@localhost \-\-import=both \e \-\-bulk\-insert \-\-format=sql data.sql # Source on localhost: ... connected. # Importing definitions and data from data.sql. #...done. .ft P .fi .SH COPYRIGHT .sp Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. .sp This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .sp This program 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. .sp You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110\-1301 USA .SH AUTHOR MySQL Utilities Team .SH COPYRIGHT 2010, Oracle and/or its affiliates. All rights reserved. .\" Generated by docutils manpage writer. .\" .