Mysqldump Tips - Oracle 5.0 Reference Manual

Table of Contents

Advertisement

An alternative to using
from within the
mysql>
USE db1;
mysql>
LOAD DATA INFILE 't1.txt' INTO TABLE t1;
If you used any data-formatting options with
use the same options with
the data file contents:
shell>
mysqlimport --fields-terminated-by=,
--fields-enclosed-by='"' --lines-terminated-by=0x0d0a db1 t1.txt
Or:
mysql>
USE db1;
mysql>
LOAD DATA INFILE 't1.txt' INTO TABLE t1
->
FIELDS TERMINATED BY ',' FIELDS ENCLOSED BY '"'
->
LINES TERMINATED BY '\r\n';
7.4.5.
mysqldump
This section surveys techniques that enable you to use
• How to make a copy a database
• How to copy a database from one server to another
• How to dump stored programs (stored procedures and functions and triggers)
• How to dump definitions and data separately
7.4.5.1. Making a Copy of a Database
shell>
mysqldump db1 > dump.sql
shell>
mysqladmin create db2
shell>
mysql db2 < dump.sql
Do not use
--databases
be included in the dump file, which overrides the effect of naming
7.4.5.2. Copy a Database from one Server to Another
On Server 1:
shell>
mysqldump --databases db1 > dump.sql
Copy the dump file from Server 1 to Server 2.
On Server 2:
shell>
mysql < dump.sql
Use of
--databases
CREATE DATABASE
default database for the reloaded data.
Alternatively, you can omit
create the database on Server 2 (if necessary) and specify it as the default database when you reload
the dump file.
On Server 1:
shell>
mysqldump db1 > dump.sql
mysqldump
mysqlimport
client:
mysql
mysqlimport
Tips
[299]
on the
[299]
with the
mysqldump
and
statements that create the database if it does exist and make it the
USE
--databases
Tips
to load the data file is to use the
when you initially dumped the table, you must
mysqldump
or
LOAD DATA INFILE
mysqldump
command line because that causes
mysqldump
command line causes the dump file to include
[299]
from the
mysqldump
629
LOAD DATA INFILE
to ensure proper interpretation of
to solve specific problems:
on the
command line.
db2
mysql
command. Then you will need to
statement
to
USE db1

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?

Questions and answers

This manual is also suitable for:

Mysql 5.0

Table of Contents