Skip Links

Network World

  • Social Web 
  • Email 
  • Close

(Comma separation for multiple addresses)
Your Message:

The best way to copy a MySQL database to another machine

Dr. Internet By Steve Blass , Network World , 09/20/2004
Steve Blass
  • Share/Email
  • Tweet This
  • Comment
  • Print

After reading your story on  Copying MySQL databases,  I would like to know whether a MySQL database can be copied from one machine to another using the mysqldump command instead of taking a snapshot by copying the data directory.

The mysqldump command can be used to export MySQL database data for one database at a time or for all MySQL data.

According to the documentation, you should consider using the mysqlhotcopy instead if you are backing up a server. Unfortunately, mysqlhotcopy might not work very well on Windows systems, and it can only be run on the system that has the database directories.

The mysqldump command uses a syntax that looks like

mysqldump [options] db_name [tables]

 where entire databases will be dumped if you do not name any tables. You can replace the db_name and tables list with "-all-databases" to dump everything.

 For MySQL versions prior to 4.1, include the -opt option in your command; otherwise, the entire result set gets loaded into memory before anything is dumped.

Loading your dumped data into another MySQL system can be done by using the "mysqlimport" command.

  • Share/Email
  • Tweet This
  • Comment
  • Print
Comments (1)
Login
Forgot your account info?

The best way to copy a MySQL database to another machineBy Anonymous on December 19, 2006, 2:23 pmmysqldump Re: This article.

Reply | Read entire comment

View all comments

Add comment
Anonymous comments subject to approval. Register here for member benefits.
Have a NetworkWorld account? Log in here. Register now for a free account.

Videos

rssRss Feed