GNU Info

Info Node: (mysql.info)Upgrading-to-arch

(mysql.info)Upgrading-to-arch


Prev: Upgrading-from-3.20 Up: Upgrade
Enter node , (file) or (file)node

Upgrading to Another Architecture
---------------------------------

If you are using MySQL Version 3.23, you can copy the `.frm', `.MYI',
and `.MYD' files between different architectures that support the same
floating-point format.  (MySQL takes care of any byte swapping issues.)

The MySQL `ISAM' data and index files (`.ISD' and `*.ISM',
respectively) are architecture-dependent and in some cases
OS-dependent.  If you want to move your applications to another machine
that has a different architecture or OS than your current machine, you
should not try to move a database by simply copying the files to the
other machine. Use `mysqldump' instead.

By default, `mysqldump' will create a file full of SQL statements.  You
can then transfer the file to the other machine and feed it as input to
the `mysql' client.

Try `mysqldump --help' to see what options are available.  If you are
moving the data to a newer version of MySQL, you should use `mysqldump
--opt' with the newer version to get a fast, compact dump.

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 --opt 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:

     shell> mysqladmin create db_name
     shell> mysqldump -h 'other hostname' --opt --compress db_name \
             | mysql db_name

You can also store the result in a file, then transfer the file to the
target machine and load the file into the database there.  For example,
you can dump a database to a file on the source machine like this:

     shell> mysqldump --quick db_name | gzip > db_name.contents.gz

(The file created in this example is compressed.) 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.contents.gz | mysql db_name

You can also use `mysqldump' and `mysqlimport' to accomplish the
database transfer.  For big tables, this is much faster than simply
using `mysqldump'.  In the commands shown below, `DUMPDIR' represents
the full pathname 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 `DUMPDIR' directory to some corresponding
directory on the target machine and load the files into MySQL there:

     shell> mysqladmin create db_name           # create database
     shell> cat DUMPDIR/*.sql | mysql db_name   # create tables in database
     shell> mysqlimport db_name DUMPDIR/*.txt   # load data into tables

Also, don't forget to copy the `mysql' database, because that's where
the grant tables (`user', `db', `host') are stored.  You may have to
run commands as the MySQL `root' user on the new machine until you have
the `mysql' database in place.

After you import the `mysql' database on the new machine, execute
`mysqladmin flush-privileges' so that the server reloads the grant table
information.


automatically generated by info2www version 1.2.2.9