Dumping Data In Sql Format With Mysqldump - Oracle 5.0 Reference Manual

Table of Contents

Advertisement

• To make a copy of a database that you can use without changing the original data.
• To test potential upgrade incompatibilities.
mysqldump
• Without
--tab
consists of
so forth), and
reloaded later using
format of the SQL statements, and to control which objects are dumped.
• With
--tab
one file as tab-delimited text, one line per table row. This file is named
directory. The server also sends a
writes it as a file named
7.4.1. Dumping Data in SQL Format with
This section describes how to use
reloading such dump files, see
By default,
mysqldump
output in a file:
shell>
mysqldump [arguments] > file_name
To dump all databases, invoke
shell>
mysqldump --all-databases > dump.sql
To dump only specific databases, name them on the command line and use the
option:
shell>
mysqldump --databases db1 db2 db3 > dump.sql
The
--databases
names. Without this option,
as table names.
With
--all-databases
statements prior to the dump output for each database. This ensures that when the dump file is
USE
reloaded, it creates each database if it does not exist and makes it the default database so database
contents are loaded into the same database from which they came. If you want to cause the dump
file to force a drop of each database before recreating it, use the
option as well. In this case,
statement.
DATABASE
To dump a single database, name it on the command line:
shell>
mysqldump --databases test > dump.sql
In the single-database case, it is permissible to omit the
shell>
mysqldump test > dump.sql
The difference between the two preceding commands is that without
output contains no
• When you reload the dump file, you must specify a default database name so that the server knows
which database to reload.
Dumping Data in SQL Format with
produces two types of output, depending on whether the
[305],
mysqldump
statements to create dumped objects (databases, tables, stored routines, and
CREATE
statements to load data into tables. The output can be saved in a file and
INSERT
to recreate the dumped objects. Options are available to modify the
mysql
[305],
produces two output files for each dumped table. The server writes
mysqldump
tbl_name.sql
mysqldump
Section 7.4.2, "Reloading SQL-Format
writes information as SQL statements to the standard output. You can save the
mysqldump
[299]
option causes all names on the command line to be treated as database
mysqldump
[298]
or
--databases
mysqldump
CREATE DATABASE
mysqldump
writes SQL statements to the standard output. This output
statement for the table to mysqldump, which
CREATE TABLE
in the output directory.
mysqldump
to create SQL-format dump files. For information about
with the
--all-databases
treats the first name as a database name and those following
[299],
mysqldump
writes a
DROP DATABASE
--databases
or
statements. This has several implications:
USE
626
[305]
option is given:
--tab
tbl_name.txt
Backups".
[298]
option:
--databases
writes
CREATE DATABASE
--add-drop-database
statement preceding each
[299]
option:
[299], the dump
--databases
in the output
[299]
and
[298]
CREATE

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the 5.0 and is the answer not in the manual?

This manual is also suitable for:

Mysql 5.0

Table of Contents