List:Commits« Previous MessageNext Message »
From:plavin Date:April 10 2007 4:27pm
Subject:svn commit - mysqldoc@docsrva: r5802 - trunk/userguide
View as plain text  
Author: plavin
Date: 2007-04-10 18:27:55 +0200 (Tue, 10 Apr 2007)
New Revision: 5802

Log:
Add to mysqldump section

Modified:
   trunk/userguide/mysqldump.xml


Modified: trunk/userguide/mysqldump.xml
===================================================================
--- trunk/userguide/mysqldump.xml	2007-04-10 13:30:12 UTC (rev 5801)
+++ trunk/userguide/mysqldump.xml	2007-04-10 16:27:55 UTC (rev 5802)
Changed blocks: 12, Lines Added: 99, Lines Deleted: 51; 10149 bytes

@@ -25,7 +25,7 @@
   </para>
 
   <para>
-    The reasons for creating backup files vary:
+    The reasons for creating back-up files vary:
 
     <itemizedlist>
 

@@ -54,8 +54,7 @@
 
   <para>
     This chapter shows how to use <literal>mysqldump</literal> for each
-    of these tasks, covering the most commonly used options and
-    capabilities.
+    of these tasks.
   </para>
 
 <!-- start options -->

@@ -70,17 +69,16 @@
     </para>
 
     <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. In this respect,
-      <literal>mysqldump</literal> does not differ from the MySQL client
-      program, <literal>mysql</literal>, or from other utilities such as
-      <literal>mysqladmin</literal>.
+      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. In this
+      respect, <literal>mysqldump</literal> does not differ from the
+      MySQL client program, <literal>mysql</literal>, or from other
+      utilities such as <literal>mysqladmin</literal>.
     </para>
 
     <para>
-      The other options
+      Other common options are:
 
       <itemizedlist>
 

@@ -165,9 +163,10 @@
       The <option>--opt</option> option is on by default so you don't
       have to specify it. However, you need to know what it does. Using
       <option>--opt</option> is shorthand for specifying <option>
-      --add-locks --add-drop-table --create-options --disable-keys
-      --extended-insert --lock-tables --quick --set-charset</option>.
-      Find below a brief description of these options.
+      --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.
     </para>
 
     <itemizedlist>

@@ -181,8 +180,8 @@
 
       <listitem>
         <para>
-          <option>--add-drop-table</option> &ndash; removes tables
-          before recreating them
+          <option>--add-drop-table</option> &ndash; remove tables before
+          recreating them
         </para>
       </listitem>
 

@@ -204,8 +203,8 @@
       <listitem>
         <para>
           <option>--extended-insert</option> &ndash; Use multiple-row
-          <literal>INSERT</literal> syntax that include several
-          <literal>VALUES</literal> lists
+          <literal>INSERT</literal> syntax that includes a
+          <literal>VALUES</literal> list for each row
         </para>
       </listitem>
 

@@ -234,13 +233,20 @@
     </itemizedlist>
 
     <para>
-      comments on the opt group
+      Each of these options can be turned off individually by using the
+      <option>--skip-<replaceable>option-name</replaceable></option>
+      syntax. For example, if you want to ensure
+      that you recreate tables as the server default table type, you can
+      turn off <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.
     </para>
 
     <para>
       Some of these options are self-explanatory and need little
-      elaboration but in the following sections In the following
-      sections we'll see how each one of these options is used
+      explanation. In any case, detailed examples of using these options
+      are given in the following sections.
     </para>
 
   </section>

@@ -253,8 +259,8 @@
 
     <para>
       To back up the contents of a server and create replacements for
-      all existing databases use the <command>mysqldump</command>
-      command, invoking this utility specifying your credentials and the
+      all existing databases invoke the <command>mysqldump</command>
+      utility specifying your credentials and the
       <option>--all-databases</option> option. Using the option short
       forms, you can redirect output to a file in the following way:
     </para>

@@ -264,35 +270,40 @@
 </programlisting>
 
     <para>
-      This is equivalent to using the <option>--user,
+      Using the short forms shown in the preceding listing
+      is equivalent to using the <option>--user,
       --password,</option> and <option>--all-databases</option> options.
       Output is sent to a file using the redirection operator,
       &laquo;<literal>&gt;</literal>&raquo;. Since the
       <option>--host</option> option is not specified it defaults to
-      <literal>localhost</literal>.
+      <literal>localhost</literal>. Since no password is 
+      specified at the command line, you will be prompted for one. 
     </para>
 
     <para>
-      Since the <literal>mysql</literal> database is
+      Specifying your password at the command line is allowed but 
+      note that you cannot leave a space between the option and 
+      your password; it must appear as <option>-p<replaceable>password</replaceable></option>.
+      If a space was allowed, the <option>-A</option> option in the
+      preceding listing would be interpreted as the password.
     </para>
-
-    <para></para>
-
+    
     <para>
-      mention that you can export binary data
+      Any kind of data can be saved in this fashion &mdash; even images
+      stored as binary data.
     </para>
 
     <para>
       If you wish to copy only specific databases replace the
       <option>-A</option> with the <option>--databases</option> followed
-      by the names of the databases that you wish to back up. The output
-      of this command is
+      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>
 
-    <para>
-      
-      To copy a specific database, specify your credentials and the
-      database name:
+    <para>      
+      If you wish to copy only one database, you do not need to use the 
+      <option>--databases</option> option. Simply specify your credentials and the
+      database name in the following fashion:
     </para>
 
 <programlisting>

@@ -305,15 +316,15 @@
     </para>
 
     <para>
-      Examine the contents of the file, keeping in mind that the
-      <option>--opt</option> group of options is on by default. For a
+      Remember that the
+      <option>--opt</option> group of options is on by default. (For a
       complete list of these options see
-      <xref  linkend="mysqldump-options"/>. To turn off any one of these
+      <xref  linkend="mysqldump-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. For example, to create one <literal>INSERT</literal>
+      statement for each record use the
+      <option>--skip-extended-inserts</option> option.
     </para>
 
     <para>

@@ -323,25 +334,60 @@
       implement.
     </para>
 
-    <warning>
+    <note>
       <para>
         If you choose to do things this way, make sure that you specify
         <option>--skip-opt</option> first. If it is the last option
-        specified it will turn off all the <option>--opt</option>
-        options.
+        specified it will turn off any of the <option>--opt</option>
+        group of options that precede it.
       </para>
-    </warning>
+    </note>
+    
+    <para>
+      In some cases you may want to copy only selected tables
+      from a database. This is done by naming the desired tables 
+      immediately following the database name. For example:
+    </para>
+    
+<programlisting>
+shell&gt; <userinput>mysqldump [options] <replaceable>db_name table1 table2</replaceable> </userinput>
+</programlisting>
 
     <para>
-      If you look at the contents of this file, you'll only find tables
-      and data from the specified database. There is also another
-      significant difference, there is <literal>CREATE
-      DATABASE</literal> or
+      Using a database name at the command line creates a copy
+      of the tables
+      and the data from the specified database. However,
+      no database is created when this syntax is used.
     </para>
 
     <para>
-      To add a <literal>CREATE DATABASE</literal> statement
+      To dump only one database and add a <literal>CREATE DATABASE</literal> statement,
+      you must use the <option>--databases</option> option. For example,
+      using the short form of the <option>--databases</option> option:
     </para>
+    
+<programlisting>
+shell&gt; <userinput>mysqldump -u <replaceable>username</replaceable>-p -B <replaceable>db_name</replaceable> &gt; <replaceable>dump.sql</replaceable></userinput>
+</programlisting>
+    
+    <warning>
+    <para>
+      When restoring from a file created in this way,
+      if the database already exists, it is dropped and then recreated.
+      Any data in the existing database will be lost.
+    </para>
+    </warning>
+    
+    <para>
+      Using <command>mysqldump</command> to
+      back up all the databases on a server is an easy way to create replacements 
+      in the event of lost data or database corruption.
+      Backing up a specific database, either with or without
+      the <option>-B</option> option is a good way 
+      to move a database from development to production.
+      The next section examines how to restore databases
+      from the script files created by <command>mysqldump</command>.
+    </para>
 
   </section>
 

@@ -350,6 +396,8 @@
     <title>Restoring</title>
 
     <para>
+      Databases are restored using the <command>mysql</command> client
+      program.To restore all the files created by
       Restoring the database or databases Recreating a database from the
       dump file is as simple as:
     </para>


Thread
svn commit - mysqldoc@docsrva: r5802 - trunk/userguideplavin10 Apr