Copying Mysql Databases To Another Machine - Oracle 5.0 Reference Manual

Table of Contents

Advertisement

• To upgrade the table using a dump and reload procedure, dump the table using mysqldump, modify
the
CREATE TABLE
After making the appropriate changes,

2.19.5. Copying MySQL Databases to Another Machine

You can copy the .frm, .MYI, and
that support the same floating-point format. (MySQL takes care of any byte-swapping issues.) See
Section 14.1, "The
In cases where you need to transfer databases between different architectures, you can use
mysqldump
machine and feed it as input to the
Use
mysqldump --help
The easiest (although not the fastest) way to move a database between two machines is to run the
following commands on the machine on which the database is located:
shell>
mysqladmin -h 'other_hostname' create db_name
shell>
mysqldump db_name | mysql -h 'other_hostname' db_name
If you want to copy a database from a remote machine over a slow network, you can use these
commands:
shell>
mysqladmin create db_name
shell>
mysqldump -h 'other_hostname' --compress db_name | mysql db_name
You can also store the dump in a file, transfer the file to the target machine, and then load the file
into the database there. For example, you can dump a database to a compressed file on the source
machine like this:
shell>
mysqldump --quick db_name | gzip > db_name.gz
Transfer the file containing the database contents to the target machine and run these commands
there:
shell>
mysqladmin create db_name
shell>
gunzip < db_name.gz | mysql db_name
You can also use
much faster than simply using mysqldump. In the following commands,
path name of the directory you use to store the output from mysqldump.
First, create the directory for the output files and dump the database:
shell>
mkdir DUMPDIR
shell>
mysqldump --tab=DUMPDIR db_name
Then transfer the files in the
and load the files into MySQL there:
shell>
mysqladmin create db_name
shell>
cat DUMPDIR/*.sql | mysql db_name
shell>
mysqlimport db_name DUMPDIR/*.txt
Do not forget to copy the
might have to run commands as the MySQL
database in place.
After you import the
privileges

Copying MySQL Databases to Another Machine

statement in the dump file to use the new collation, and reload the table.
Storage
MyISAM
to create a file containing SQL statements. You can then transfer the file to the other
mysql
to see what options are available.
and
mysqldump
mysqlimport
DUMPDIR
database because that is where the grant tables are stored. You
mysql
database on the new machine, execute
mysql
so that the server reloads the grant table information.
should report no error.
CHECK TABLE
files for
.MYD
MyISAM
Engine".
client.
to transfer the database. For large tables, this is
directory to some corresponding directory on the target machine
# create database
# create tables in database
# load data into tables
user on the new machine until you have the
root
158
tables between different architectures
DUMPDIR
mysqladmin flush-
represents the full
mysql

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

Subscribe to Our Youtube Channel

This manual is also suitable for:

Mysql 5.0

Table of Contents