Author: plavin
Date: 2007-04-17 01:36:05 +0200 (Tue, 17 Apr 2007)
New Revision: 5912
Log:
Changes -- thanks Paul
Modified:
trunk/userguide/excel-mysql.xml
trunk/userguide/mysqldump.xml
Modified: trunk/userguide/excel-mysql.xml
===================================================================
--- trunk/userguide/excel-mysql.xml 2007-04-16 21:44:13 UTC (rev 5911)
+++ trunk/userguide/excel-mysql.xml 2007-04-16 23:36:05 UTC (rev 5912)
Changed blocks: 2, Lines Added: 3, Lines Deleted: 3; 896 bytes
@@ -111,9 +111,9 @@
</section>
- <section id="designing-table">
+ <section id="spreadsheet-file">
- <title>Designing a Table</title>
+ <title>The Spreadsheet File</title>
<para>
We want to import the data directly into a table that mirrors the
@@ -376,7 +376,7 @@
<para>
Creating a table to match the fields as described in
- <xref linkend="designing-table"/> is a fairly straightforward
+ <xref linkend="spreadsheet-file"/> is a fairly straightforward
matter. For
importing the data our principal concern is to get the right
information in the right fields without truncating data.
Modified: trunk/userguide/mysqldump.xml
===================================================================
--- trunk/userguide/mysqldump.xml 2007-04-16 21:44:13 UTC (rev 5911)
+++ trunk/userguide/mysqldump.xml 2007-04-16 23:36:05 UTC (rev 5912)
Changed blocks: 27, Lines Added: 73, Lines Deleted: 60; 16420 bytes
@@ -14,9 +14,9 @@
<para>
The <command>mysqldump</command> utility is a database back-up
program capable of copying everything on a specific MySQL server
- — both the structure and the data. It can also be used to copy
+ — both the database objects and the data. It can also be used to copy
a number of databases, one particular database, one or more tables
- from a specific database, or just specific elements from one table.
+ from a specific database, or just specific records from one table.
Any kind of data can be saved using this utility — even images
stored as binary data.
</para>
@@ -65,7 +65,9 @@
<para>
This chapter shows how to use <command>mysqldump</command> for each
- of these tasks.
+ of these tasks. This is not meant as a definite treatment of
+ <code>mysqldump</code>; for complete coverage of this utility see
+ <ulink url="&base-url-refman;5.0/en/mysqldump.html"/>.
</para>
<!-- start options -->
@@ -82,8 +84,10 @@
<para>
Since the <command>mysqldump</command> utility gives access to a
- specific MySQL server, you must use the <option>--user,
- --password, --host</option>, and <option>--port</option> options.
+ specific MySQL server, you must have credentials on that server;
+ you must explicitly or implicitly provide a <option>--user</option>
+ and <option>--password</option>. Likewise you must provide
+ <option>--host</option> and <option>--port</option> options.
In this respect, <command>mysqldump</command> does not differ from
the MySQL client program, <command>mysql</command>, or from other
utilities such as <command>mysqladmin</command>.
@@ -97,14 +101,15 @@
<listitem>
<para>
<option>--all-databases, -A </option> – Dump all
- tables in all databases
+ tables in all databases.
</para>
</listitem>
<listitem>
<para>
- <option>--databases, -B </option> – Specify the
- databases to dump
+ <option>--databases, -B </option> – Specify this option
+ and <command>mysqldump</command>
+ regards all name arguments as database names
</para>
</listitem>
@@ -112,14 +117,14 @@
<para>
<option>--fields-terminated-by </option> – Used in
conjunction with the <option>--tab</option> option to
- specify a field terminator
+ specify a field terminator.
</para>
</listitem>
<listitem>
<para>
<option>--no-data </option> – Save database objects
- but not data
+ but not data.
</para>
</listitem>
@@ -133,7 +138,7 @@
<listitem>
<para>
<option>--skip-opt </option> – Turn off the
- <option>--opt</option> group of options
+ <option>--opt</option> group of options.
</para>
</listitem>
@@ -141,7 +146,7 @@
<para>
<option>--tab=<replaceable>path</replaceable>, -T
<replaceable>path</replaceable> </option> – Create
- tab-separated data files
+ tab-separated data files in the named directory.
</para>
</listitem>
@@ -150,21 +155,21 @@
<option>--tables </option> – Override the
<option>--databases</option> option.
<command>mysqldump</command> regards all name arguments
- following this option as table names
+ following this option as table names.
</para>
</listitem>
<listitem>
<para>
- <option>--where='where_condition', -w 'where_condition'
- </option> – only dump rows selected by the where
- condition
+ <option>--where=<replaceable>'where_condition'</replaceable>, -w <replaceable>'where_condition'</replaceable>
+ </option> – Only dump rows selected by the where
+ condition.
</para>
</listitem>
<listitem>
<para>
- <option>--xml </option> – dump output as XML
+ <option>--xml </option> – Dump output as XML.
</para>
</listitem>
@@ -211,22 +216,22 @@
Using <option>--opt</option> is shorthand for specifying
<option> --add-locks, --add-drop-table, --create-options,
--disable-keys, --extended-insert, --lock-tables,
- --quick,</option> and <option>--set-charset</option>. Find below
- a brief description of these options.
+ --quick,</option> and <option>--set-charset</option>. Find
+ a brief description of these options in what follows.
<itemizedlist>
<listitem>
<para>
- <option>--add-locks </option> – lock tables before
- inserting data
+ <option>--add-locks </option> – Lock tables before
+ inserting data.
</para>
</listitem>
<listitem>
<para>
- <option>--add-drop-table </option> – remove tables
- before recreating them
+ <option>--add-drop-table </option> – Remove tables
+ before recreating them.
</para>
</listitem>
@@ -234,14 +239,15 @@
<para>
<option>--create-options </option> – Include all
MySQL-specific table options in the <literal>CREATE
- TABLE</literal> statements
+ TABLE</literal> statements.
</para>
</listitem>
<listitem>
<para>
<option>--disable-keys </option> – Improve speed by
- disabling indexes before inserting data
+ disabling indexes before inserting data.
+ (Applies only to MyISAM tables and only to non-unique indexes.)
</para>
</listitem>
@@ -249,21 +255,21 @@
<para>
<option>--extended-insert </option> – Use
multiple-row <literal>INSERT</literal> syntax that
- includes a <literal>VALUES</literal> list for each row
+ includes a <literal>VALUES</literal> list for each row.
</para>
</listitem>
<listitem>
<para>
- <option>--lock-tables </option> – lock tables before
- dumping them
+ <option>--lock-tables </option> – Lock tables before
+ dumping them.
</para>
</listitem>
<listitem>
<para>
- <option>--quick </option> – retrieve rows from a
- table one row at a time, reducing demands on memory
+ <option>--quick </option> – Retrieve rows from a
+ table one row at a time, reducing demands on memory.
</para>
</listitem>
@@ -272,7 +278,7 @@
<option>--set-charset</option> – Add <literal>SET
NAMES</literal>
<replaceable>default_character_set</replaceable> to the
- output
+ output.
</para>
</listitem>
@@ -288,9 +294,11 @@
<option>--create-options</option> by specifying
<option>--skip-create-options</option>. No engine or character
set will be specified in the <literal>CREATE TABLE</literal>
- statement. Turning off <option>--extended-insert</option>
- creates a separate <literal>INSERT</literal> statement for each
- row, making it much easier to remove unwanted rows.
+ statement. Turn off <option>--extended-insert</option>
+ by specifying the <option>--skip-extended-inserts</option> option.
+ Doing this creates a separate <literal>INSERT</literal> statement for each
+ row, making it much easier to remove individual <literal>INSERT</literal>
+ statements.
</para>
</section>
@@ -313,7 +321,7 @@
</para>
<programlisting>
-shell> <userinput>mysqldump -u <replaceable>username</replaceable> -p -A > <replaceable>dump.sql</replaceable></userinput>
+shell> <userinput>mysqldump -u <replaceable>user_name</replaceable> -p -A > <replaceable>dump.sql</replaceable></userinput>
</programlisting>
<para>
@@ -340,7 +348,7 @@
<para>
If you wish to copy only specific databases, replace
<option>-A</option> with the <option>--databases</option> option
- (short form, <option>-B</option>) followed by the names of the
+ (or its short form, <option>-B</option>) followed by the names of the
databases that you wish to back up. The file created by this
command will contain only the databases specified.
</para>
@@ -362,7 +370,7 @@
</para>
<programlisting>
-shell> <userinput>mysqldump -u <replaceable>username</replaceable> -p <replaceable>db_name</replaceable> > <replaceable>dump.sql</replaceable></userinput>
+shell> <userinput>mysqldump -u <replaceable>user_name</replaceable> -p <replaceable>db_name</replaceable> > <replaceable>dump.sql</replaceable></userinput>
</programlisting>
<para>
@@ -377,9 +385,7 @@
<xref linkend="opt-group-options"/>.) To turn off any one of
these options you can use the
<option>--skip-<replaceable>option-name</replaceable></option>
- option. For example, to create one <literal>INSERT</literal>
- statement for each record use the
- <option>--skip-extended-inserts</option> option.
+ option.
</para>
<para>
@@ -405,7 +411,7 @@
</para>
<programlisting>
-shell> <userinput>mysqldump [options] <replaceable>db_name table1 table2</replaceable></userinput>
+ shell> <userinput>mysqldump <replaceable>[options]</replaceable> <replaceable>db_name table1 table2</replaceable></userinput>
</programlisting>
<para>
@@ -415,7 +421,7 @@
</para>
<programlisting>
-shell> <userinput>mysqldump [options] <replaceable>db_name table1</replaceable> --where=<replaceable>field_name>1000</replaceable></userinput>
+shell> <userinput>mysqldump [options] <replaceable>db_name table1</replaceable> --where=<replaceable>'field_name>1000'</replaceable></userinput>
</programlisting>
<para>
@@ -448,7 +454,7 @@
</para>
<programlisting>
-shell> <userinput>mysqldump -u <replaceable>username</replaceable> -p -B <replaceable>db_name</replaceable> > <replaceable>dump.sql</replaceable></userinput>
+shell> <userinput>mysqldump -u <replaceable>user_name</replaceable> -p -B <replaceable>db_name</replaceable> > <replaceable>dump.sql</replaceable></userinput>
</programlisting>
<para>
@@ -459,7 +465,7 @@
</para>
<programlisting>
- shell> <userinput>mysqldump -u <replaceable>username</replaceable> -p -B <replaceable>db_name</replaceable> <option>--tables <replaceable>table1</replaceable></option> > <replaceable>dump.sql</replaceable></userinput>
+ shell> <userinput>mysqldump -u <replaceable>user_name</replaceable> -p -B <replaceable>db_name</replaceable> <option>--tables <replaceable>table1</replaceable></option> > <replaceable>dump.sql</replaceable></userinput>
</programlisting>
<para>
@@ -496,7 +502,7 @@
</para>
<programlisting>
-shell> <userinput>mysql -u <replaceable>username</replaceable> -p < <replaceable>dump.sql</replaceable></userinput>
+shell> <userinput>mysql -u <replaceable>user_name</replaceable> -p < <replaceable>dump.sql</replaceable></userinput>
</programlisting>
<warning>
@@ -522,17 +528,22 @@
</para>
<programlisting>
- shell> <userinput>mysql -u <replaceable>username</replaceable> -p <replaceable>db_name</replaceable> < <replaceable>dump.sql</replaceable></userinput>
+ shell> <userinput>mysql -u <replaceable>user_name</replaceable> -p <replaceable>db_name</replaceable> < <replaceable>dump.sql</replaceable></userinput>
</programlisting>
<para>
In this case, you need not worry about overwriting an existing
database, but you will overwrite any tables in the existing
- database that have the same names as tables in the back-up file.
+ database that have the same names as tables in the back-up file
+ if the file contains <literal>DROP TABLE</literal> and
+ <literal>CREATE TABLE</literal> statements. To remove
+ these statements from a dump file, create it using the
+ <option>--skip-add-drop-table</option> and <option>--no-create-info</option>
+ options.
</para>
<para>
- If you are uploading a database dump file to an online database
+ If you are uploading a database dump file to a remote database
then you will have to specify the <option>--host</option> option.
If you don't have access to your MySQL server from a remote
location, copy your script file to the server, log in using
@@ -555,23 +566,23 @@
— a word processor or a spreadsheet, for example — you
might want to export data in text format. The most common way of
exporting a file in text format is by using the
- <option>--tab</option> option and specifying a target directory.
- Use the short form, <literal>-T</literal>, to do this in the
- following way:
+ <option>--tab</option> or <option>-T</option> option and specifying the
+ full pathname to the target directory:
+
</para>
<programlisting>
-shell> <userinput>mysqldump -u <replaceable>username</replaceable> -p <replaceable>db_name</replaceable> -T <replaceable>/tmp</replaceable></userinput>
+shell> <userinput>mysqldump -u <replaceable>user_name</replaceable> -p <replaceable>db_name</replaceable> -T <replaceable>/tmp</replaceable></userinput>
</programlisting>
<para>
- Dumping a database specifying this option creates a script file of
+ Dumping a database specifying this option creates, for each table, a script file of
the table structure using the table name and the extension
<literal>sql</literal> and a tab-separated file of the data using
the table name and the extension <literal>txt</literal>. These
files are created in the directory specified with the
- <option>-T</option> option This directory must be writable and the
- user indicated by <replaceable>username</replaceable> must have
+ <option>-T</option> option. This directory must be writable and the
+ user indicated by <replaceable>user_name</replaceable> must have
the <literal>FILE</literal> privilege. For more information about
the <literal>FILE</literal> privilege see ...
@@ -632,12 +643,13 @@
</para>
<para>
- For an XML representation of the data and structure of a database
+ For an XML representation of the data and the database objects
use the <option>--xml</option> option. This option creates an XML
document in the following format:
</para>
<programlisting>
+<replaceable>
<?xml version="1.0"?>
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database name="sakila">
@@ -667,7 +679,8 @@
</table_data>
[more table definitions and data] ...
</database>
- </mysqldump>
+ </mysqldump>
+</replaceable>
</programlisting>
<para>
@@ -684,17 +697,17 @@
</remark>
</para>
- <para>
+ <!--Leave out? add Migration Toolkit reference? para>
Apart from exporting databases in various text formats, it is also
possible to export to other database formats such as MS SQL
Server, PostgreSQL, or even to convert to earlier versions of
MySQL. This is done using the
- <option>--compatible=<replaceable>name</replaceable></option>
+ <option>– –compatible=<replaceable>name</replaceable></option>
option. Using this option makes a best guess at transforming MySQL
to the named format. However, this topic is beyond the scope of
this discussion. For more information see
<ulink url="&base-url-refman;5.0/en/mysqldump.html"/>.
- </para>
+ </para-->
</section>
| Thread |
|---|
| • svn commit - mysqldoc@docsrva: r5912 - trunk/userguide | plavin | 17 Apr |