Copying MySQL Databases to Another Machine ALTER TABLE Method REPAIR TABLE Method 2.11.14 Copying MySQL Databases to Another Machine Note 297 If you want to copy a database from a remote machine over a slow network, you can use these commands: 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: If GTIDs are in use on the server where you create the dump ( gtid_mode=ON ), by default,  mysqldump  includes the contents of the  gtid_executed  set in the dump to transfer these to the new machine. The results of this can vary depending on the MySQL Server versions involved. Check the description for  mysqldump’s --set- gtid-purged  option to find what happens with the versions you are using, and how to change the behavior if the outcome of the default behavior is not suitable for your situation. Use  mysqldump --help  to see what options are available. In cases where you need to transfer databases between different architectures, you can use  mysqldump to create a file containing SQL statements. You can then transfer the file to the other machine and feed it as input to the  mysql  client. mysqlcheck --repair  provides command-line access to the  REPAIR TABLE  statement. This can be a more convenient means of repairing tables because you can use the  --databases  or  --all- databases  option to repair all tables in specific databases or all databases, respectively: The  REPAIR TABLE  method is only applicable to  MyISAM ,  ARCHIVE , and  CSV  tables. You can use  REPAIR TABLE  if the table checking operation indicates that there is a corruption or that an upgrade is required. For example, to repair a  MyISAM  table, use this statement: If you are not sure which storage engine to specify in the  ALTER TABLE  statement, use  SHOW CREATE TABLE  to display the table definition. To rebuild a table with  ALTER TABLE , use a “null”  alteration; that is, an  ALTER TABLE  statement that “changes”  the table to use the storage engine that it already has. For example, if  t1  is an  InnoDB  table, use this statement: ALTER TABLE t1 ENGINE = InnoDB; REPAIR TABLE t1; mysqlcheck --repair --databases  db_name  ... mysqlcheck --repair --all-databases mysqladmin -h ’ other_hostname ’ create  db_name mysqldump  db_name  | mysql -h ’ other_hostname ’  db_name mysqladmin create  db_name mysqldump -h ’ other_hostname ’ --compress  db_name  | mysql  db_name