7
**drizzledump** [*OPTIONS*] *database* [*tables*]
9
**drizzledump** [*OPTIONS*] *--databases* [*OPTIONS*] *DB1* [*DB2* *DB3*...]
11
**drizzledump** [*OPTIONS*] *--all-databases* [*OPTIONS*]
7
:program:`drizzledump` [:ref:`OPTIONS <drizzledump-options-label>`] *database* [*tables*]
9
:program:`drizzledump` [:ref:`OPTIONS <drizzledump-options-label>`] :option:`--databases` *DB1* [*DB2* *DB3*...]
11
:program:`drizzledump` [:ref:`OPTIONS <drizzledump-options-label>`] :option:`--all-databases`
24
24
Any binary data in tables will be converted into hexadecimal output so that it
25
25
does not corrupt the dump file.
27
.. _drizzledump-options-label:
27
29
Drizzledump options
28
30
-------------------
30
32
The :program:`drizzledump` tool has several available options:
32
.. option:: -A, --all-databases
34
Dumps all databases found on the server apart from *information_schema* and
35
*data_dictionary* in Drizzle and *information_schema*, *performance_schema*
38
.. option:: -f, --force
34
.. option:: --all-databases, -A
36
Dumps all databases found on the server apart from ``information_schema`` and
37
``data_dictionary`` in Drizzle and ``information_schema``,
38
``performance_schema`` and ``mysql`` in MySQL.
40
.. option:: --force, -f
40
42
Continue even if we get an sql-error.
42
.. option:: -?, --help
44
.. option:: --help, -?
44
46
Show a message with all the available options.
46
.. option:: -x, --lock-all-tables
48
.. option:: --lock-all-tables, -x
48
50
Locks all the tables for all databases with a global read lock. The lock is
49
51
released automatically when :program:`drizzledump` ends.
77
81
Show progress of the dump every *rows* of the dump. Requires
78
82
:option:`--verbose`
80
.. option:: -v, --verbose
84
.. option:: --verbose, -v
82
86
Sends various verbose information to stderr as the dump progresses.
84
.. option:: --skip-create
86
Do not dump the CREATE TABLE / CREATE DATABASE statements.
88
88
.. option:: --skip-extended-insert
90
Dump every row on an individual line. For example::
90
Dump every row on an individual line. For example:
92
94
INSERT INTO `t1` VALUES (1,'hello');
93
95
INSERT INTO `t1` VALUES (2,'world');
110
112
:option:`--skip-add-drop-table`, :option:`--skip-disable-keys`
111
113
and :option:`--skip-add-locks`.
113
.. option:: -B, --databases
115
.. option:: --databases, -B
115
117
Dump several databases. The databases do not need to follow on after this
116
118
option, they can be anywhere in the command line.
118
.. option:: -K, --skip-disable-keys
120
.. option:: --skip-disable-keys, -K
120
Do not dump the statements `ALTER TABLE ... DISABLE KEYS` and
121
`ALTER TABLE ... ENABLE KEYS`
122
Do not dump the statements ``ALTER TABLE ... DISABLE KEYS`` and
123
``ALTER TABLE ... ENABLE KEYS``
123
125
.. option:: --ignore-table table
125
Do not dump specified table, needs to be in the format `database.table`.
127
Do not dump specified table, needs to be in the format ``database.table``.
126
128
Can be specified multiple times for multiple tables.
128
130
.. option:: --insert-ignore
130
Add the `IGNORE` keyword into every `INSERT` statement.
132
Add the ``IGNORE`` keyword into every ``INSERT`` statement.
132
134
.. option:: --no-autocommit
134
Make the dump of each table a single transaction by wrapping it in `COMMIT`
136
Make the dump of each table a single transaction by wrapping it in ``COMMIT``
137
.. option:: -n, --no-create-db
139
.. option:: --no-create-db, -n
139
Do not dump the `CREATE DATABASE` statements when using
141
Do not dump the ``CREATE DATABASE`` statements when using
140
142
:option:`--all-databases` or :option:`--databases`.
142
.. option:: -t, --skip-create
144
Do not dump the `CREATE TABLE` statements.
146
.. option:: -d, --no-data
144
.. option:: --skip-create, -t
146
Do not dump the ``CREATE TABLE`` statements.
148
.. option:: --no-data, -d
148
150
Do not dump the data itself, used to dump the schemas only.
150
152
.. option:: --replace
152
Use `REPLACE INTO` statements instead of `INSERT INTO`
154
Use ``REPLACE INTO`` statements instead of ``INSERT INTO``
154
156
.. option:: --destination-type type (=stdout)
206
208
mangled data. This is because MySQL will convert the data to UTF8 on the way
207
209
out to drizzledump and you effectively get a double-conversion to UTF8.
209
This typically happens with PHP apps that do not use 'SET NAMES'.
211
This typically happens with PHP apps that do not use ``SET NAMES``.
211
213
In these cases setting this option will retrieve the data as you see it in your
214
216
.. versionadded:: 2011-01-31
216
.. option:: -h, --host hostname (=localhost)
218
.. option:: --host, -h hostname (=localhost)
218
220
The hostname of the database server.
220
.. option:: -u, --user username
222
.. option:: --user, -u username
222
224
The username for the database server.
224
.. option:: -P, --password password
226
.. option:: --password, -P password
226
228
The password for the database server.
228
.. option:: -p, --port port (=3306,4427)
230
.. option:: --port, -p port (=4427)
230
The port number of the database server. Defaults to 3306 for MySQL protocol
231
and 4427 for Drizzle protocol.
232
The port number of the database server.
233
234
.. option:: --protocol protocol (=mysql)
243
244
Backups using Drizzledump
244
245
-------------------------
246
Backups of a database can be made very simply by running the following::
248
$ drizzledump --all-databases > dumpfile.sql
250
This can then be re-imported into drizzle at a later date using::
252
$ drizzle < dumpfile.sql
247
Backups of a database can be made very simply by running the following:
251
$ drizzledump --all-databases > dumpfile.sql
253
This can then be re-imported into drizzle at a later date using:
257
$ drizzle < dumpfile.sql
254
259
MySQL Migration using Drizzledump
255
260
---------------------------------
267
:program:`drizzledump` will by default try to connect via port 4427. To
268
connect to a MySQL server, a port (such as 3306) must be specified.
272
:program:`drizzledump` will by default try to connect via. port 4427 so to
273
connect to a MySQL server a port (such as 3306) must be specified.
270
275
So, simply connecting to a MySQL server with :program:`drizzledump` as follows
271
will give you a Drizzle compatible output::
273
$ drizzledump --all-databases --host=mysql-host --port=3306 --user=mysql-user --password > dumpfile.sql
276
will give you a Drizzle compatible output:
280
$ drizzledump --all-databases --host=mysql-host --port=3306 --user=mysql-user --password > dumpfile.sql
275
282
Additionally :program:`drizzledump` can now dump from MySQL and import directly
276
into a Drizzle server as follows::
278
$ drizzledump --all-databases --host=mysql-host --port=3306 --user=mysql-user --password --destination-type=database --desination-host=drizzle-host
283
into a Drizzle server as follows:
287
$ drizzledump --all-databases --host=mysql-host --port=3306 --user=mysql-user --password --destination-type=database --desination-host=drizzle-host
302
311
* mediumblob -> blob
303
312
* longblob -> blob
306
* date/datetime default 0000-00-00 -> default NULL (Currently, ALL date columns have their DEFAULT set to NULL on migration)
307
* date/datetime NOT NULL columns -> NULL
308
* any date data containing 0000-00-00 -> NULL
309
* time -> int of the number of seconds [1]_
310
* enum-> DEFAULT NULL
315
* date/datetime default 0000-00-00 -> default NULL [2]_
316
* date/datetime NOT NULL columns -> NULL [2]_
317
* any date data containing 0000-00-00 -> NULL [2]_
318
* time -> int of the number of seconds [3]_
319
* enum-> DEFAULT NULL [4]_
312
321
.. rubric:: Footnotes
314
.. [1] This prevents data loss since MySQL's TIME data type has a range of
323
.. [1] There is currently no good alternative to SET, this is simply to preserve
324
the data in the column. There is a new alternative to SET to be included
327
.. [2] Currently, ALL date columns have their DEFAULT set to NULL on migration.
328
This is so that any rows with 0000-00-00 dates can convert to NULL.
330
.. [3] This prevents data loss since MySQL's TIME data type has a range of
315
331
-838:59:59 - 838:59:59, and Drizzle's TIME type has a range of
316
00:00:00 - 23:59:61.999999.
334
.. [4] This is so that empty entries such as '' will convert to NULL.