Link to home
Start Free TrialLog in
Avatar of kwh3856
kwh3856Flag for United States of America

asked on

I need to migrate a MySQL database from one machine to another. How do you accomplish this task?

I have an application in production that uses a MySQL database on a Windows 2003 server.  I need to build some custom apps to insert data into the applications tables. I do not want to devleop on a production system so I would like to migrate the database to another machine so I do not mess anything up if something goes wrong.  What is the easiest way to do this.  Can I just copy the data directory under the MySql directory to another machine and access it that way or is there a special process I must follow to get MySql to recognize the database on the new machine?
Avatar of futurefiles
futurefiles
Flag of United Kingdom of Great Britain and Northern Ireland image

easyly done using mysqldump

form a command prompt
mysqldump -u [user name] -p=[password]  
[database name] > [dump file]

Then restore by switching the > to <
Like this
mysqldump -u [user name] -p=[password]  
[database name] < [dump file]
you may have to create the database first though with
create database [DBNAME];
ASKER CERTIFIED SOLUTION
Avatar of vpalhories
vpalhories

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kwh3856

ASKER

Thank you.  That is exactly what I wanted to do but was not sure if it work.

Thanks
Kenny