~drizzle-trunk/drizzle/development

2425.2.2 by Daniel Nichter
A lot of doc changes: rewrite and expand Configuration and Administration, re-order top-level sections, enhance Contributing, add Release Notes, add Help and Support, fix title casing, label all plugins, other misc. enhancements.
1
drizzledump Backup Tool
1794.2.9 by Monty Taylor
Made some TOC structure changes. Added stubs for a couple of command line
2
=======================
3
1799.3.2 by Monty Taylor
Use drizzledump sphinx docs as manpage source.
4
Synopsis
5
--------
6
2194.5.1 by Andrew Hutchings
Port my drizzledump docs fixes from another branch which I thought were merged
7
:program:`drizzledump` [:ref:`OPTIONS <drizzledump-options-label>`] *database* [*tables*]
8
2197.2.1 by Andrew Hutchings
Fix drizzledump forward references
9
:program:`drizzledump` [:ref:`OPTIONS <drizzledump-options-label>`] :option:`--databases <drizzledump --databases>` *DB1* [*DB2* *DB3*...]
2194.5.1 by Andrew Hutchings
Port my drizzledump docs fixes from another branch which I thought were merged
10
2197.2.1 by Andrew Hutchings
Fix drizzledump forward references
11
:program:`drizzledump` [:ref:`OPTIONS <drizzledump-options-label>`] :option:`--all-databases <drizzledump --all-databases>`
1799.3.2 by Monty Taylor
Use drizzledump sphinx docs as manpage source.
12
13
Description
14
-----------
15
16
:program:`drizzledump` is used for backing up and
1794.2.9 by Monty Taylor
Made some TOC structure changes. Added stubs for a couple of command line
17
restoring logical backups of a Drizzle database, as well as for migrating
2222.2.1 by Mark Atwood
documentation work
18
from a more traditional *MySQL* server. 
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
19
2222.2.1 by Mark Atwood
documentation work
20
When connecting to a Drizzle server it will do a plain dump of the server.
21
When connecting to a MySQL server, it will automatically detect this, and
22
will convert the dump of the tables and data into a Drizzle compatible format.
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
23
24
Any binary data in tables will be converted into hexadecimal output so that it
25
does not corrupt the dump file.
26
2194.5.1 by Andrew Hutchings
Port my drizzledump docs fixes from another branch which I thought were merged
27
.. _drizzledump-options-label:
28
2425.2.2 by Daniel Nichter
A lot of doc changes: rewrite and expand Configuration and Administration, re-order top-level sections, enhance Contributing, add Release Notes, add Help and Support, fix title casing, label all plugins, other misc. enhancements.
29
drizzledump Options
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
30
-------------------
31
32
The :program:`drizzledump` tool has several available options:
33
2194.5.5 by Andrew Hutchings
Fix options indexing
34
.. program:: drizzledump 
35
2194.5.1 by Andrew Hutchings
Port my drizzledump docs fixes from another branch which I thought were merged
36
.. option:: --all-databases, -A
37
2194.5.3 by Andrew Hutchings
Markup fixes
38
   Dumps all databases found on the server apart from ``information_schema`` and
39
   ``data_dictionary`` in Drizzle and ``information_schema``,
40
   ``performance_schema`` and ``mysql`` in MySQL.
2194.5.1 by Andrew Hutchings
Port my drizzledump docs fixes from another branch which I thought were merged
41
42
.. option:: --force, -f
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
43
2222.2.1 by Mark Atwood
documentation work
44
   Continue even if a sql-error is received.
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
45
2194.5.1 by Andrew Hutchings
Port my drizzledump docs fixes from another branch which I thought were merged
46
.. option:: --help, -?
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
47
2194.5.3 by Andrew Hutchings
Markup fixes
48
   Show a message with all the available options.
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
49
2194.5.1 by Andrew Hutchings
Port my drizzledump docs fixes from another branch which I thought were merged
50
.. option:: --lock-all-tables, -x
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
51
2194.5.3 by Andrew Hutchings
Markup fixes
52
   Locks all the tables for all databases with a global read lock.  The lock is
53
   released automatically when :program:`drizzledump` ends.
54
   Turns on :option:`--single-transaction` and :option:`--lock-tables`.
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
55
56
.. option:: --single-transaction
57
2194.5.3 by Andrew Hutchings
Markup fixes
58
   Creates a consistent snapshot by dumping the tables in a single transaction.
59
   During the snapshot no other connected client should use any of the
60
   following as this will implicitly commit the transaction and prevent the
61
   consistency:
2194.5.1 by Andrew Hutchings
Port my drizzledump docs fixes from another branch which I thought were merged
62
2194.5.3 by Andrew Hutchings
Markup fixes
63
   .. code-block:: mysql
1994.4.20 by Marisa Plumb
fixed build warnings
64
65
	ALTER TABLE
66
	DROP TABLE
67
	RENAME TABLE
68
	TRUNCATE TABLE
69
2194.5.3 by Andrew Hutchings
Markup fixes
70
   Only works with InnoDB.
1799.7.4 by Andrew Hutchings
Fix up some more options and the docs
71
72
.. option:: --skip-opt
73
2194.5.3 by Andrew Hutchings
Markup fixes
74
   A shortcut for :option:`--skip-drop-table`, :option:`--skip-create`, 
75
   :option:`--skip-extended-insert` and :option:`--skip-disable-keys`
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
76
77
.. option:: --tables t1 t2 ...
78
2194.5.3 by Andrew Hutchings
Markup fixes
79
   Dump a list of tables.
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
80
81
.. option:: --show-progress-size rows (=10000)
82
2194.5.3 by Andrew Hutchings
Markup fixes
83
   Show progress of the dump every *rows* of the dump.  Requires
84
   :option:`--verbose`
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
85
2194.5.1 by Andrew Hutchings
Port my drizzledump docs fixes from another branch which I thought were merged
86
.. option:: --verbose, -v
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
87
2194.5.3 by Andrew Hutchings
Markup fixes
88
   Sends various verbose information to stderr as the dump progresses.
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
89
90
.. option:: --skip-extended-insert
91
2194.5.3 by Andrew Hutchings
Markup fixes
92
   Dump every row on an individual line.  For example:
2194.5.1 by Andrew Hutchings
Port my drizzledump docs fixes from another branch which I thought were merged
93
94
.. code-block:: mysql
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
95
1994.4.20 by Marisa Plumb
fixed build warnings
96
	INSERT INTO `t1` VALUES (1,'hello');
97
	INSERT INTO `t1` VALUES (2,'world');
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
98
2222.2.1 by Mark Atwood
documentation work
99
   This is useful for calculating and storing diffs of dump files.
100
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
101
.. option:: --skip-dump-date
102
2194.5.3 by Andrew Hutchings
Markup fixes
103
   Do not display the date/time at the end of the dump.
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
104
105
.. option:: --no-defaults
106
2194.5.3 by Andrew Hutchings
Markup fixes
107
   Do not attempt to read configuration from configuration files.
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
108
109
.. option:: --add-drop-database
110
2194.5.3 by Andrew Hutchings
Markup fixes
111
   Add ``DROP DATABASE`` statements before ``CREATE DATABASE``.
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
112
113
.. option:: --compact
114
2194.5.3 by Andrew Hutchings
Markup fixes
115
   Gives a more compact output by disabling header/footer comments and enabling
116
   :option:`--skip-add-drop-table`, :option:`--skip-disable-keys` 
117
   and :option:`--skip-add-locks`.
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
118
2194.5.1 by Andrew Hutchings
Port my drizzledump docs fixes from another branch which I thought were merged
119
.. option:: --databases, -B
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
120
2194.5.3 by Andrew Hutchings
Markup fixes
121
   Dump several databases.  The databases do not need to follow on after this
122
   option, they can be anywhere in the command line.
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
123
2194.5.1 by Andrew Hutchings
Port my drizzledump docs fixes from another branch which I thought were merged
124
.. option:: --skip-disable-keys, -K
1799.7.4 by Andrew Hutchings
Fix up some more options and the docs
125
2194.5.3 by Andrew Hutchings
Markup fixes
126
   Do not dump the statements ``ALTER TABLE ... DISABLE KEYS`` and
127
   ``ALTER TABLE ... ENABLE KEYS``
1799.7.4 by Andrew Hutchings
Fix up some more options and the docs
128
129
.. option:: --ignore-table table
130
2194.5.3 by Andrew Hutchings
Markup fixes
131
   Do not dump specified table, needs to be in the format ``database.table``.
132
   Can be specified multiple times for multiple tables.
1799.7.4 by Andrew Hutchings
Fix up some more options and the docs
133
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
134
.. option:: --insert-ignore
135
2194.5.3 by Andrew Hutchings
Markup fixes
136
   Add the ``IGNORE`` keyword into every ``INSERT`` statement.
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
137
138
.. option:: --no-autocommit
139
2194.5.3 by Andrew Hutchings
Markup fixes
140
   Make the dump of each table a single transaction by wrapping it in ``COMMIT``
141
   statements.
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
142
2194.5.1 by Andrew Hutchings
Port my drizzledump docs fixes from another branch which I thought were merged
143
.. option:: --no-create-db, -n
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
144
2194.5.3 by Andrew Hutchings
Markup fixes
145
   Do not dump the ``CREATE DATABASE`` statements when using
146
   :option:`--all-databases` or :option:`--databases`.
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
147
2194.5.1 by Andrew Hutchings
Port my drizzledump docs fixes from another branch which I thought were merged
148
.. option:: --skip-create, -t
149
2194.5.3 by Andrew Hutchings
Markup fixes
150
   Do not dump the ``CREATE TABLE`` statements.
2194.5.1 by Andrew Hutchings
Port my drizzledump docs fixes from another branch which I thought were merged
151
152
.. option:: --no-data, -d
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
153
2222.2.1 by Mark Atwood
documentation work
154
   Do not dump the data itself. Used to dump the schemas only.
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
155
156
.. option:: --replace
157
2194.5.3 by Andrew Hutchings
Markup fixes
158
   Use ``REPLACE INTO`` statements instead of ``INSERT INTO``
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
159
160
.. option:: --destination-type type (=stdout)
161
2194.5.3 by Andrew Hutchings
Markup fixes
162
   Destination of the data.
163
164
   **stdout**
165
   The default.  Output to the command line
166
167
   **database**
168
   Connect to another database and pipe data to that.
169
170
   .. versionadded:: Drizzle7 2010-09-27
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
171
172
.. option:: --destination-host hostname (=localhost)
173
2194.5.3 by Andrew Hutchings
Markup fixes
174
   The hostname for the destination database.  Requires
175
   :option:`--destination-type` `= database`
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
176
2194.5.3 by Andrew Hutchings
Markup fixes
177
   .. versionadded:: Drizzle7 2010-09-27
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
178
179
.. option:: --destination-port port (=3306)
180
2194.5.3 by Andrew Hutchings
Markup fixes
181
   The port number for the destination database.  Requires
182
   :option:`--destination-type` `= database`
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
183
2194.5.3 by Andrew Hutchings
Markup fixes
184
   .. versionadded:: Drizzle7 2010-09-27
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
185
186
.. option:: --destination-user username
187
2194.5.3 by Andrew Hutchings
Markup fixes
188
   The username for the destinations database.  Requires
189
   :option:`--destination-type` `= database`
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
190
2194.5.3 by Andrew Hutchings
Markup fixes
191
   .. versionadded:: Drizzle7 2010-09-27
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
192
193
.. option:: --destination-password password
194
2194.5.3 by Andrew Hutchings
Markup fixes
195
   The password for the destination database.  Requires
196
   :option:`--destination-type` `= database`
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
197
2194.5.3 by Andrew Hutchings
Markup fixes
198
   .. versionadded:: Drizzle7 2010-09-27
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
199
200
.. option:: --destination-database database
201
2194.5.3 by Andrew Hutchings
Markup fixes
202
   The database for the destination database, for use when only dumping a
203
   single database.  Requires
204
   :option:`--destination-type` `= database`
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
205
2194.5.3 by Andrew Hutchings
Markup fixes
206
   .. versionadded:: Drizzle7 2010-09-27
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
207
2121.8.1 by Andrew Hutchings
Add option --my-data-is-mangled to drizzledump to prevent further corruption by retrieving UTF8 data stored in a non-UTF8 table during a MySQL -> Drizzle conversion
208
.. option:: --my-data-is-mangled
209
2194.5.3 by Andrew Hutchings
Markup fixes
210
   If your data is UTF8 but has been stored in a latin1 table using a latin1
211
   connection then corruption is likely and drizzledump by default will retrieve
212
   mangled data.  This is because MySQL will convert the data to UTF8 on the way
213
   out to drizzledump and you effectively get a double-conversion to UTF8.
214
215
   This typically happens with PHP apps that do not use ``SET NAMES``.
216
217
   In these cases setting this option will retrieve the data as you see it in
218
   your application.
219
220
   .. versionadded:: Drizzle7 2011-01-31
2121.8.1 by Andrew Hutchings
Add option --my-data-is-mangled to drizzledump to prevent further corruption by retrieving UTF8 data stored in a non-UTF8 table during a MySQL -> Drizzle conversion
221
2194.5.1 by Andrew Hutchings
Port my drizzledump docs fixes from another branch which I thought were merged
222
.. option:: --host, -h hostname (=localhost)
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
223
2194.5.3 by Andrew Hutchings
Markup fixes
224
   The hostname of the database server.
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
225
2194.5.1 by Andrew Hutchings
Port my drizzledump docs fixes from another branch which I thought were merged
226
.. option:: --user, -u username
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
227
2194.5.3 by Andrew Hutchings
Markup fixes
228
   The username for the database server.
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
229
2194.5.1 by Andrew Hutchings
Port my drizzledump docs fixes from another branch which I thought were merged
230
.. option:: --password, -P password
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
231
2194.5.3 by Andrew Hutchings
Markup fixes
232
   The password for the database server.
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
233
2194.5.1 by Andrew Hutchings
Port my drizzledump docs fixes from another branch which I thought were merged
234
.. option:: --port, -p port (=4427)
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
235
2194.5.3 by Andrew Hutchings
Markup fixes
236
   The port number of the database server.
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
237
238
.. option:: --protocol protocol (=mysql)
239
2194.5.3 by Andrew Hutchings
Markup fixes
240
   The protocol to use when connecting to the database server.  Options are:
241
242
   **mysql**
243
   The standard MySQL protocol.
244
245
   **drizzle**
246
   The Drizzle protocol.
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
247
2425.2.2 by Daniel Nichter
A lot of doc changes: rewrite and expand Configuration and Administration, re-order top-level sections, enhance Contributing, add Release Notes, add Help and Support, fix title casing, label all plugins, other misc. enhancements.
248
Backups Using drizzledump
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
249
-------------------------
250
2194.5.1 by Andrew Hutchings
Port my drizzledump docs fixes from another branch which I thought were merged
251
Backups of a database can be made very simply by running the following:
252
253
.. code-block:: bash
254
255
  $ drizzledump --all-databases > dumpfile.sql
256
257
This can then be re-imported into drizzle at a later date using:
258
259
.. code-block:: bash
260
261
  $ drizzle < dumpfile.sql
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
262
2194.5.4 by Andrew Hutchings
A few more minor fixups
263
.. _drizzledump-migration-label:
264
2425.2.2 by Daniel Nichter
A lot of doc changes: rewrite and expand Configuration and Administration, re-order top-level sections, enhance Contributing, add Release Notes, add Help and Support, fix title casing, label all plugins, other misc. enhancements.
265
MySQL Migration Using drizzledump
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
266
---------------------------------
267
268
As of version 2010-09-27 there is the capability to migrate databases from
269
MySQL to Drizzle using :program:`drizzledump`.
270
271
:program:`drizzledump` will automatically detect whether it is talking to a
272
MySQL or Drizzle database server.  If it is connected to a MySQL server it will
273
automatically convert all the structures and data into a Drizzle compatible 
2165.3.1 by Andrew Hutchings
Make fixes to drizzledump docs
274
format.
275
2165.2.3 by Andrew Hutchings
Add favicon to docs
276
.. warning::
2165.3.1 by Andrew Hutchings
Make fixes to drizzledump docs
277
2194.5.1 by Andrew Hutchings
Port my drizzledump docs fixes from another branch which I thought were merged
278
   :program:`drizzledump` will by default try to connect via. port 4427 so to
279
   connect to a MySQL server a port (such as 3306) must be specified.
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
280
281
So, simply connecting to a MySQL server with :program:`drizzledump` as follows
2194.5.1 by Andrew Hutchings
Port my drizzledump docs fixes from another branch which I thought were merged
282
will give you a Drizzle compatible output:
283
284
.. code-block:: bash
285
286
  $ drizzledump --all-databases --host=mysql-host --port=3306 --user=mysql-user --password > dumpfile.sql
1799.3.1 by Andrew Hutchings
Add documentation for drizzledump
287
288
Additionally :program:`drizzledump` can now dump from MySQL and import directly
2194.5.1 by Andrew Hutchings
Port my drizzledump docs fixes from another branch which I thought were merged
289
into a Drizzle server as follows:
290
291
.. code-block:: bash
292
293
  $ drizzledump --all-databases --host=mysql-host --port=3306 --user=mysql-user --password --destination-type=database --desination-host=drizzle-host
2099.2.1 by Andrew Hutchings
Add errors page to drizzle client docs
294
2165.3.1 by Andrew Hutchings
Make fixes to drizzledump docs
295
.. note::
296
297
   Please take special note of :ref:`old-passwords-label` if you have connection
298
   issues from :program:`drizzledump` to your MySQL server.
299
300
.. note::
2449.3.1 by Mark Atwood
RST admonitions like note and warning should have a new line before the content
301
2165.3.1 by Andrew Hutchings
Make fixes to drizzledump docs
302
   If you find your VARCHAR and TEXT data does not look correct in a drizzledump
303
   output, it is likely that you have UTF8 data stored in a non-UTF8 table.  In
304
   which case please check the :option:`--my-data-is-mangled` option.
2121.8.1 by Andrew Hutchings
Add option --my-data-is-mangled to drizzledump to prevent further corruption by retrieving UTF8 data stored in a non-UTF8 table during a MySQL -> Drizzle conversion
305
1945.3.5 by Marisa Plumb
more sql doc modifications
306
When you migrate from MySQL to Drizzle, the following conversions are required:
307
1994.4.39 by Marisa Plumb
new material to address https://bugs.launchpad.net/drizzle/+bug/684803, new functions
308
 * MyISAM -> InnoDB
309
 * FullText -> drop it (with stderr warning)
310
 * int unsigned -> bigint
311
 * tinyint -> int
312
 * smallint -> int
313
 * mediumint -> int
314
 * tinytext -> text
315
 * mediumtext -> text
316
 * longtext -> text
317
 * tinyblob -> blob
318
 * mediumblob -> blob
319
 * longblob -> blob
320
 * year -> int
2194.5.1 by Andrew Hutchings
Port my drizzledump docs fixes from another branch which I thought were merged
321
 * set -> text [1]_
322
 * date/datetime default 0000-00-00 -> default NULL [2]_
323
 * date/datetime NOT NULL columns -> NULL [2]_
324
 * any date data containing 0000-00-00 -> NULL [2]_
325
 * time -> int of the number of seconds [3]_
326
 * enum-> DEFAULT NULL [4]_
1994.4.39 by Marisa Plumb
new material to address https://bugs.launchpad.net/drizzle/+bug/684803, new functions
327
2165.3.1 by Andrew Hutchings
Make fixes to drizzledump docs
328
.. rubric:: Footnotes
329
2194.5.1 by Andrew Hutchings
Port my drizzledump docs fixes from another branch which I thought were merged
330
.. [1] There is currently no good alternative to SET, this is simply to preserve
331
       the data in the column.  There is a new alternative to SET to be included
332
       at a later date.
333
334
.. [2] Currently, ALL date columns have their DEFAULT set to NULL on migration.
335
       This is so that any rows with 0000-00-00 dates can convert to NULL.
336
337
.. [3] This prevents data loss since MySQL's TIME data type has a range of
2165.3.1 by Andrew Hutchings
Make fixes to drizzledump docs
338
       -838:59:59 - 838:59:59, and Drizzle's TIME type has a range of
2194.5.1 by Andrew Hutchings
Port my drizzledump docs fixes from another branch which I thought were merged
339
       00:00:00 - 23:59:59.
340
341
.. [4] This is so that empty entries such as '' will convert to NULL.