1794.2.9
by Monty Taylor
Made some TOC structure changes. Added stubs for a couple of command line |
1 |
Drizzledump Backup Tool
|
2 |
=======================
|
|
3 |
||
1799.3.2
by Monty Taylor
Use drizzledump sphinx docs as manpage source. |
4 |
Synopsis
|
5 |
--------
|
|
6 |
||
7 |
**drizzledump** [*OPTIONS*] *database* [*tables*] |
|
8 |
||
9 |
**drizzledump** [*OPTIONS*] *--databases* [*OPTIONS*] *DB1* [*DB2* *DB3*...] |
|
10 |
||
11 |
**drizzledump** [*OPTIONS*] *--all-databases* [*OPTIONS*] |
|
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 |
1799.3.2
by Monty Taylor
Use drizzledump sphinx docs as manpage source. |
18 |
from *MySQL*.
|
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
19 |
|
20 |
When connecting to a Drizzle server it will do a plain dump of the server. It |
|
21 |
will, however, automatically detect when it is connected to a *MySQL* server and
|
|
22 |
will convert the tables and data into a Drizzle compatible format. |
|
23 |
||
24 |
Any binary data in tables will be converted into hexadecimal output so that it |
|
25 |
does not corrupt the dump file. |
|
26 |
||
27 |
Drizzledump options
|
|
28 |
-------------------
|
|
29 |
||
30 |
The :program:`drizzledump` tool has several available options: |
|
31 |
||
32 |
.. option:: -A, --all-databases |
|
1994.4.20
by Marisa Plumb
fixed build warnings |
33 |
|
34 |
Dumps all databases found on the server apart from *information_schema* and
|
|
35 |
*data_dictionary* in Drizzle and *information_schema*, *performance_schema* |
|
36 |
and *mysql* in MySQL.
|
|
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
37 |
|
38 |
.. option:: -f, --force |
|
39 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
40 |
Continue even if we get an sql-error. |
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
41 |
|
42 |
.. option:: -?, --help |
|
43 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
44 |
Show a message with all the available options. |
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
45 |
|
46 |
.. option:: -x, --lock-all-tables |
|
47 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
48 |
Locks all the tables for all databases with a global read lock. The lock is |
49 |
released automatically when :program:`drizzledump` ends. |
|
50 |
Turns on :option:`--single-transaction` and :option:`--lock-tables`. |
|
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
51 |
|
52 |
.. option:: --single-transaction |
|
53 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
54 |
Creates a consistent snapshot by dumping the tables in a single transaction. |
55 |
During the snapshot no other connected client should use any of the |
|
56 |
following as this will implicitly commit the transaction and prevent the |
|
57 |
consistency::
|
|
58 |
||
59 |
ALTER TABLE
|
|
60 |
DROP TABLE
|
|
61 |
RENAME TABLE
|
|
62 |
TRUNCATE TABLE
|
|
63 |
||
64 |
Only works with InnoDB. |
|
1799.7.4
by Andrew Hutchings
Fix up some more options and the docs |
65 |
|
66 |
.. option:: --skip-opt |
|
67 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
68 |
A shortcut for :option:`--skip-drop-table`, :option:`--skip-create`, |
69 |
:option:`--skip-extended-insert` and :option:`--skip-disable-keys` |
|
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
70 |
|
71 |
.. option:: --tables t1 t2 ... |
|
72 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
73 |
Dump a list of tables. |
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
74 |
|
75 |
.. option:: --show-progress-size rows (=10000) |
|
76 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
77 |
Show progress of the dump every *rows* of the dump. Requires
|
78 |
:option:`--verbose` |
|
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
79 |
|
80 |
.. option:: -v, --verbose |
|
81 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
82 |
Sends various verbose information to stderr as the dump progresses. |
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
83 |
|
84 |
.. option:: --skip-create |
|
85 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
86 |
Do not dump the CREATE TABLE / CREATE DATABASE statements. |
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
87 |
|
88 |
.. option:: --skip-extended-insert |
|
89 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
90 |
Dump every row on an individual line. For example::
|
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
91 |
|
1994.4.20
by Marisa Plumb
fixed build warnings |
92 |
INSERT INTO `t1` VALUES (1,'hello');
|
93 |
INSERT INTO `t1` VALUES (2,'world');
|
|
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
94 |
|
95 |
.. option:: --skip-dump-date |
|
96 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
97 |
Do not display the date/time at the end of the dump. |
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
98 |
|
99 |
.. option:: --no-defaults |
|
100 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
101 |
Do not attempt to read configuration from configuration files. |
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
102 |
|
103 |
.. option:: --add-drop-database |
|
104 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
105 |
Add `DROP DATABASE` statements before `CREATE DATABASE`. |
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
106 |
|
107 |
.. option:: --compact |
|
108 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
109 |
Gives a more compact output by disabling header/footer comments and enabling |
110 |
:option:`--skip-add-drop-table`, :option:`--skip-disable-keys` |
|
111 |
and :option:`--skip-add-locks`. |
|
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
112 |
|
113 |
.. option:: -B, --databases |
|
114 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
115 |
Dump several databases. The databases do not need to follow on after this |
116 |
option, they can be anywhere in the command line. |
|
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
117 |
|
1799.7.4
by Andrew Hutchings
Fix up some more options and the docs |
118 |
.. option:: -K, --skip-disable-keys |
119 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
120 |
Do not dump the statements `ALTER TABLE ... DISABLE KEYS` and
|
121 |
`ALTER TABLE ... ENABLE KEYS`
|
|
1799.7.4
by Andrew Hutchings
Fix up some more options and the docs |
122 |
|
123 |
.. option:: --ignore-table table |
|
124 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
125 |
Do not dump specified table, needs to be in the format `database.table`.
|
126 |
Can be specified multiple times for multiple tables. |
|
1799.7.4
by Andrew Hutchings
Fix up some more options and the docs |
127 |
|
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
128 |
.. option:: --insert-ignore |
129 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
130 |
Add the `IGNORE` keyword into every `INSERT` statement. |
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
131 |
|
132 |
.. option:: --no-autocommit |
|
133 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
134 |
Make the dump of each table a single transaction by wrapping it in `COMMIT`
|
135 |
statements. |
|
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
136 |
|
137 |
.. option:: -n, --no-create-db |
|
138 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
139 |
Do not dump the `CREATE DATABASE` statements when using
|
140 |
:option:`--all-databases` or :option:`--databases`. |
|
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
141 |
|
1799.7.4
by Andrew Hutchings
Fix up some more options and the docs |
142 |
.. option:: -t, --skip-create |
1994.4.20
by Marisa Plumb
fixed build warnings |
143 |
|
144 |
Do not dump the `CREATE TABLE` statements.
|
|
1799.7.4
by Andrew Hutchings
Fix up some more options and the docs |
145 |
|
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
146 |
.. option:: -d, --no-data |
147 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
148 |
Do not dump the data itself, used to dump the schemas only. |
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
149 |
|
150 |
.. option:: --replace |
|
151 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
152 |
Use `REPLACE INTO` statements instead of `INSERT INTO` |
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
153 |
|
154 |
.. option:: --destination-type type (=stdout) |
|
155 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
156 |
Destination of the data. |
157 |
||
158 |
**stdout**
|
|
159 |
The default. Output to the command line |
|
160 |
||
161 |
**database**
|
|
162 |
Connect to another database and pipe data to that. |
|
163 |
||
164 |
.. versionadded:: 2010-09-27 |
|
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
165 |
|
166 |
.. option:: --destination-host hostname (=localhost) |
|
167 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
168 |
The hostname for the destination database. Requires |
169 |
:option:`--destination-type` `= database` |
|
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
170 |
|
1994.4.20
by Marisa Plumb
fixed build warnings |
171 |
.. versionadded:: 2010-09-27 |
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
172 |
|
173 |
.. option:: --destination-port port (=3306) |
|
174 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
175 |
The port number for the destination database. Requires |
176 |
:option:`--destination-type` `= database` |
|
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
177 |
|
1994.4.20
by Marisa Plumb
fixed build warnings |
178 |
.. versionadded:: 2010-09-27 |
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
179 |
|
180 |
.. option:: --destination-user username |
|
181 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
182 |
The username for the destinations database. Requires |
183 |
:option:`--destination-type` `= database` |
|
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
184 |
|
1994.4.20
by Marisa Plumb
fixed build warnings |
185 |
.. versionadded:: 2010-09-27 |
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
186 |
|
187 |
.. option:: --destination-password password |
|
188 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
189 |
The password for the destination database. Requires |
190 |
:option:`--destination-type` `= database` |
|
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
191 |
|
1994.4.20
by Marisa Plumb
fixed build warnings |
192 |
.. versionadded:: 2010-09-27 |
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
193 |
|
194 |
.. option:: --destination-database database |
|
195 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
196 |
The database for the destination database, for use when only dumping a |
197 |
single database. Requires |
|
198 |
:option:`--destination-type` `= database` |
|
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
199 |
|
1994.4.20
by Marisa Plumb
fixed build warnings |
200 |
.. versionadded:: 2010-09-27 |
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
201 |
|
202 |
.. option:: -h, --host hostname (=localhost) |
|
203 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
204 |
The hostname of the database server. |
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
205 |
|
206 |
.. option:: -u, --user username |
|
207 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
208 |
The username for the database server. |
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
209 |
|
210 |
.. option:: -P, --password password |
|
211 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
212 |
The password for the database server. |
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
213 |
|
214 |
.. option:: -p, --port port (=3306,4427) |
|
215 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
216 |
The port number of the database server. Defaults to 3306 for MySQL protocol |
217 |
and 4427 for Drizzle protocol. |
|
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
218 |
|
219 |
.. option:: --protocol protocol (=mysql) |
|
220 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
221 |
The protocol to use when connecting to the database server. Options are: |
222 |
||
223 |
**mysql**
|
|
224 |
The standard MySQL protocol. |
|
225 |
||
226 |
**drizzle**
|
|
227 |
The Drizzle protocol. |
|
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
228 |
|
229 |
Backups using Drizzledump
|
|
230 |
-------------------------
|
|
231 |
||
232 |
Backups of a database can be made very simply by running the following:: |
|
233 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
234 |
$ drizzledump --all-databases > dumpfile.sql |
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
235 |
|
236 |
This can then be re-imported into drizzle at a later date using:: |
|
237 |
||
1994.4.20
by Marisa Plumb
fixed build warnings |
238 |
$ drizzle < dumpfile.sql |
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
239 |
|
240 |
MySQL Migration using Drizzledump
|
|
241 |
---------------------------------
|
|
242 |
||
243 |
As of version 2010-09-27 there is the capability to migrate databases from |
|
244 |
MySQL to Drizzle using :program:`drizzledump`. |
|
245 |
||
246 |
:program:`drizzledump` will automatically detect whether it is talking to a |
|
247 |
MySQL or Drizzle database server. If it is connected to a MySQL server it will |
|
248 |
automatically convert all the structures and data into a Drizzle compatible |
|
2099.2.1
by Andrew Hutchings
Add errors page to drizzle client docs |
249 |
format. It will, however, by default try to connect via. port 4427 so to |
250 |
connect to a MySQL server a port must be specified. |
|
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
251 |
|
252 |
So, simply connecting to a MySQL server with :program:`drizzledump` as follows |
|
253 |
will give you a Drizzle compatible output:: |
|
254 |
||
2099.2.1
by Andrew Hutchings
Add errors page to drizzle client docs |
255 |
$ drizzledump --all-databases --host=mysql-host --port=3306 --user=mysql-user --password > dumpfile.sql |
1799.3.1
by Andrew Hutchings
Add documentation for drizzledump |
256 |
|
257 |
Additionally :program:`drizzledump` can now dump from MySQL and import directly |
|
258 |
into a Drizzle server as follows:: |
|
259 |
||
2099.2.1
by Andrew Hutchings
Add errors page to drizzle client docs |
260 |
$ drizzledump --all-databases --host=mysql-host --port=3306 --user=mysql-user --password --destination-type=database --desination-host=drizzle-host |
261 |
||
262 |
Please take special note of :ref:`old-passwords-label` if you have connection |
|
263 |
issues from :program:`drizzledump` to your MySQL server. |
|
1945.3.5
by Marisa Plumb
more sql doc modifications |
264 |
|
265 |
When you migrate from MySQL to Drizzle, the following conversions are required: |
|
266 |
||
1994.4.39
by Marisa Plumb
new material to address https://bugs.launchpad.net/drizzle/+bug/684803, new functions |
267 |
* MyISAM -> InnoDB
|
268 |
* FullText -> drop it (with stderr warning)
|
|
269 |
* int unsigned -> bigint
|
|
270 |
* tinyint -> int
|
|
271 |
* smallint -> int
|
|
272 |
* mediumint -> int
|
|
273 |
* tinytext -> text
|
|
274 |
* mediumtext -> text
|
|
275 |
* longtext -> text
|
|
276 |
* tinyblob -> blob
|
|
277 |
* mediumblob -> blob
|
|
278 |
* longblob -> blob
|
|
279 |
* time -> int (of seconds)
|
|
280 |
* year -> int
|
|
281 |
* set -> text
|
|
282 |
* date/datetime default 0000-00-00 -> default NULL (Currently, ALL date columns have their DEFAULT set to NULL on migration)
|
|
283 |
* date/datetime NOT NULL columns -> NULL
|
|
284 |
* any date data containing 0000-00-00 -> NULL
|
|
285 |
* TIME -> INT of the number of seconds*
|
|
286 |
* enum-> DEFAULT NULL
|
|
287 |
||
288 |
* This prevents data loss since MySQL's TIME data type has a range of -838:59:59 - 838:59:59, and Drizzle's TIME type has a range of 00:00:00 - 23:59:61.999999.
|