MySQL Forums
Forum List  »  Other Migration

Re: Mysql db migration from one server to another server.
Posted by: Larry Irwin
Date: August 17, 2007 10:34AM

I use a script called "dumpdb" that contains the following mysqldump command:
=== the following is all on one line ===
mysqldump --user=root --password=[rootpassword] --opt --no-create-db --databases $1 | egrep -v "^CREATE DATABASE|^USE " > $1.sql
=== end of script ===

So, I run "dumpdb prexnew" and it creates a file called prexnew.sql with all the schema and data, but not the CREATE DATABASE and USE commands.

I can then take thatfile to another serverand put it in, say, /tmp.
From the mysql prompt I can do the following:

CREATE DATABASE prexproduction;
USE prexproduction;
SOURCE /tmp/prexnew.sql;

Then add the grants needed for users and it is done!

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Mysql db migration from one server to another server.
3611
August 17, 2007 10:34AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.