Moving a MySQL installation?

Mark Richards mark.richards at massmicro.com
Fri Apr 13 19:33:20 EDT 2007


Don Levey wrote:
> I'm upgrading a home machine, which in practice involves simply building 
> a new machine and moving things over to the bigger, faster box.  Not 
> being much of a MySQL person, but using it as the back end of a number 
> of things (Gallery2, Amarok, and others), I find myself needing to move 
> the old data to the new machine or recreate it.  I envision three 
> possibilities, in decreasing levels of desirability:

I'm of the opinion that the path of least resistance is often a greased 
skid to disaster.  So option 1 is not the one I would try at all, 
although in theory (if the MySQL setups are identical - 
version/features/and who knows what else) you ought to be fine.

My preference would be your option 2 which can be done in a single 
statement to export each database and a single statement to import each 
database:

mysqldump -u USER -p  DATABASE > wholedb.sql

	You will be prompted to enter the password for USER

then to restore into a new mysql database

mysql -u USER -p DATABASE < wholedb.sql

	You'll be prompted to enter the password for USER.

Replace USER and DATABASE with appropriate names.

Before discarding the source MySQL installation I'd be certain that 
everything is intact on the new one.

Also, make certain your fresh MySQL installation has at least been 
initialized before you try to import.

/m

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.




More information about the Discuss mailing list