39. • MYSQLEXP is free, simple and efficient. It’s
used to export data from mysql database.
• You can execute a sql statement explicitly or
read it from sql file, yet you can flexibly specify
the field delimiter, and what field enclosed by.
MYSQLEXP-What is MYSQLEXP?
40. royalwzy@tools$ ./mysqlexp
mysqlexp Version 2.1.0.0, for OS X, by Wang Zhaoyang(royalwzy.com)
<sonne.k.wang@gmail.com>
This tool is used to export data through sql statement.
Usage: mysqlexp [OPTIONS] [database]
-?, --help Display this help and exit.
-I, --help Synonym for -?.
-h, --host=name Connect to host, [localhost] for default.
-u, --user=name User for login, [root] for defualt.
-p, --password=name Password to use when connecting to server, [] for
default.
-D, --database=name Database to use, [mysql] for default.
-P, --port=# Port number to use for connection, [3306] for default.
-S, --socket=name The socket file to use for connection.
-c, --charset-set=name The charset to use for connection, [utf8] for default.
-v, --verbose Write more information, [0] for default.
-V, --version Output version information and exit.
-H, --header Whether display header or not.
-d, --delimiter=symbol Field delimiter, [,] for default.
-E, --enclose=symbol What field enclose by.
-e, --sql=statement Sql statement to execute.
-s, --sqlfile=name The file to store sql statement, instead of reading
from command line.
-f, --dumpfile=name Write data to the dump file, [mysqlexp.csv] for
default.
-b, --feedback=nums How many rows to feedback, [500000] for default.
MYSQLEXP-How to use it?
42. MYSQLCLONE is free, simple and efficient.
It’s used to transfer a mysql database to the
other.
MYSQLCLONE-What is MYSQLCLONE?
43. royalwzy@tools$ ./mysqlclone
mysqlclone Version 1.2.0.0, for OS X, by Wang Zhaoyang(royalwzy.com)
<sonne.k.wang@gmail.com>
This tool is used to clone database.
Usage: mysqlclone [OPTIONS] [database]
-?, --help Display this help and exit.
-h, --help Synonym for -?.
--src-host=name Source connect to host.
--src-user=name Source user for login.
--src-password=name Source password to use when connecting to server.
--src-port=# Source port number to use for connection, [3306] for default.
--src-socket=name The source socket file to use for connection.
--src-db=name Source databases to clone, cann't be system databases.
--dst-host=name Destination connect to host.
--dst-user=name Destination user for login.
--dst-password=name Destination password to use when connecting to server.
--dst-port=# Destination port number to use for connection, [3306] for
default.
--dst-socket=name The destination socket file to use for connection.
--dst-db=name Database names are remapped to another database, cann't be system
databases.
--dst-bin-log Whether generate binlog or not , [false] for default.
-m, --mode Which mode to transfer data, can only be load or insert, [load]
for default.
-d, --drop-src-db Whether drop source database or not, [FALSE] for default.
-D, --no-data No row information, [FALSE] for default.
-E, --events Events included, [FALSE] for default.
-R, --routines functions and procedures included, [FALSE] for default.
-x, --lock-all-tables Locks all tables across all databases, [Lock the table to be
read] for default.
-v, --verbose Write more information, [0] for default.
-V, --version Output version information and exit.
MYSQLCLONE-How to use it?
44. MYSQLCLONE-Quick Examples!
1.LOAD mode:
royalwzy@tools$ ./mysqlclone --src-host=localhost --src-user=root --src-db=test --dst-host=localhost --dst-
user=root --dst-db=test1
2014-12-05 21:05:00 INFO: database test started to clone, and remapped to test1.
2014-12-05 21:05:00 INFO: - table [t1] was transferred, Records: 0 Deleted: 0 Skipped: 0 Warnings: 0
2014-12-05 21:05:00 INFO: - table [t2] was transferred, Records: 3 Deleted: 0 Skipped: 0 Warnings: 0
2.SCHEMA only:
royalwzy@tools$ ./mysqlclone --src-host=localhost --src-user=root --src-db=test --dst-host=localhost --dst-
user=root --dst-db=test1 -R -E -D
2014-12-05 21:06:08 INFO: database test started to clone, and remapped to test1.
2014-12-05 21:06:08 INFO: - table [t1] was transferred.
2014-12-05 21:06:08 INFO: - table [t2] was transferred.
2014-12-05 21:06:08 INFO: - procedure [pr_test] was transferred.
2014-12-05 21:06:08 INFO: - procedure [pr_time] was transferred.
2014-12-05 21:06:08 INFO: - function [fn_test] was transferred.
2014-12-05 21:06:08 INFO: - event [event_test] was transferred.
3.INSERT mode:
royalwzy@tools$ ./mysqlclone --src-host=localhost --src-user=root --src-db=test --dst-host=localhost --dst-
user=root --dst-db=test1 --mode=INSERT
2014-12-05 21:04:16 INFO: database test started to clone, and remapped to test1.
2014-12-05 21:04:16 INFO: - table [t1] was transferred, [0] row succeed and [0] row failed.
2014-12-05 21:04:16 INFO: - table [t2] was transferred, [3] rows succeed and [0] row failed.