Download MySQL Workbench 5.2 - MySQL Community Downloads

Transcript
mysqldbexport — Export Object Definitions or Data from a Database
$ mysqldbcopy --source=root@localhost:3310 \
--destination=root@localhost:3311 test123 --rpl=master \
--rpl-user=rpl
# Source on localhost: ... connected.
# Destination on localhost: ... connected.
# Source on localhost: ... connected.
# Stopping slave
# Copying database test123
# Copying TABLE test123.t1
# Copying data for TABLE test123.t1
# Connecting to the current server as master
# Starting slave
#...done.
To copy a database from one slave to another attached to the same master, you can use the following
command using the slave with the database to be copied as the source and the slave where the
database needs to copied to as the destination:
$ mysqldbcopy --source=root@localhost:3311 \
--destination=root@localhost:3312 test123 --rpl=slave \
--rpl-user=rpl
# Source on localhost: ... connected.
# Destination on localhost: ... connected.
# Source on localhost: ... connected.
# Stopping slave
# Copying database test123
# Copying TABLE test123.t1
# Copying data for TABLE test123.t1
# Connecting to the current server's master
# Starting slave
#...done.
14.4.6. mysqldbexport — Export Object Definitions or Data from a
Database
This utility exports metadata (object definitions) or data or both from one or more databases. By
default, the export includes only definitions.
mysqldbexport differs from mysqldump in that it can produce output in a variety of formats to
make your data extraction/transport much easier. It permits you to export your data in the format most
suitable to an external tool, another MySQL server, or other use without the need to reformat the data.
To exclude specific objects by name, use the --exclude [274] option with a name in db.*obj*
format, or you can supply a search pattern. For example, --exclude=db1.trig1 [274] excludes
the single trigger and --exclude=trig_ [274] excludes all objects from all databases having a
name that begins with trig and has a following character.
To skip objects by type, use the --skip [275] option with a list of the objects to skip. This enables
you to extract a particular set of objects, say, for exporting only events (by excluding all other types).
Similarly, to skip creation of UPDATE statements for BLOB data, specify the --skip-blobs [276]
option.
To specify how to display output, use one of the following values with the --format [275] option:
• sql (default)
Display output using SQL statements. For definitions, this consists of the appropriate CREATE
and GRANT statements. For data, this is an INSERT statement (or bulk insert if the --bulkinsert [274] option is specified).
• grid
Display output in grid or table format like that of the mysql monitor.
• csv
272