Home
 

Customer Support

Search for keywords:

Browse by category:

How do I export and move my database tables between servers or copy databases?

First, see this FAQ about how to create your MySQL database using OnSite.

The first step is to dump out the contents of the database running on the old server. You can do this by using the "mysqldump" command on the old server. This command will create all the sql necessary to recreate all the tables in your database, and is called a "dump". A dump can either be printed to your screen, or if there is a lot of data, the dump can be directed into to a file.

To dump your database from the old host, get a shell prompt there with telnet or ssh, and then type this all on 1 single line:
mysqldump -u DBUSER -p DBNAME > DBNAME.sql
substituting DBUSER with your MySQL username at the old host and DBNAME with your database name from the old host.

You will be prompted for your old host's MySQL password, which will not echo back at you as you type. After you provide the right password, you will have a file in your current directory called DBNAME.sql containing your entire database.

You'll need to get this file moved onto our system by either 1) FTP'ing it down to your own computer and then uploading it from there to your account on our system, or, 2) by moving the file directly from the old host to your account here with the 'ftp' or 'scp' command.

After you have the moved the dumpfile from the old host to your account here, follow these instructions on how to import the dump into your MySQL database running here.

User-Contributed Notes

add a note
04-Sep-2003 18:30
To FTP a dumpfile directly from the old host to here, type this at your
old host's shell prompt after you have created the dumpfile:

    ftp ftp.modwest.com

Enter your Modwest username at the first prompt.
Enter your Modwest password at the second prompt. (It will not echo back
as you type).

Then you will be logged in and have a prompt like this:

230 User logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> 

Then type:

     put dbname.sql

where 'dbname.sql' is the name of your dumpfile, and it will copy the
file to your account here. 

When you see:

226 Transfer complete.

It is finished and you can then follow the import FAQ:

    http://www.modwest.com/help/kb.phtml?cat=6&qid=241

04-Sep-2003 18:35
To SCP a dumpfile directly from the old host to here, type this at your
old host's shell prompt after you have created the dumpfile:

       scp dbname.sql myself@ftp.modwest.com:/dbname.sql

where "dbname.sql" is the name of the dumpfile you just created and
"myself" is your Modwest hosting account username.

Enter your Modwest password at the prompt. (It will not echo back as you
type).

Then you'll see a progress bar as the file is copied to your account
here. Once it's done, then follow the import FAQ.

01-Apr-2004 18:51
To copy tables between 2 databases hosted at Modwest, 

1. Make sure you have at least 2 databases here, both created using the
Add Database section of your Control Panel

2. Use the Manage Databases link in your control panel and you'll see
both databases. 

3. Click the + sign next to the database name in the left window pane to
expand it to see the individual tables.

4. Click a table name in the left pane

5. Click Operations in the right pane

6. Pull down the appropriate dropdown menus for "Move Table To" and then
pull the dropdown for the new database name. Click "Go".

7. Do the same thing for every table in the original db that you want to
copy.

11-Nov-2004 15:27
If you have a lot of data, you should avoid the 'extended insert' option
when creating the dump,
(http://dev.mysql.com/doc/mysql/en/mysqldump.html) because otherwise you
could run into 'max_allowed_packet' errors when importing the dump.

anonymous -at- example.com
04-Jun-2007 11:10
Tarantula From Inverted Software can do that for you. Download it and
define the old and new servers. then connect to both of them, right
click the database you need to move and select "copy". then just paste
it into the new server.

15-Aug-2007 12:45
For databases on various servers you can specify the database server
with the -h flag.

Two explicit examples

mysqldump -u DBUSER -h db.modwest.com -p DBNAME > DBNAME.sql
mysqldump -u DBUSER -h db1.modwest.com -p DBNAME > DBNAME.sql

add a note

Related Questions:


How do I import delimited data into MySQL?

How do I change my MySQL password?

How do I import a MySQL dumpfile into my database?

How can I export data in CSV or tab delimited format?

How do I connect to my MySQL database?

Why do i get a query syntax error 1064 from MySQL when the syntax seems correct?

I can't connect to local MySQL server through socket 'mysql.sock'

How do I create a .my.cnf MySQL preference file?

What is my database server name?

How do I change MySQL timezone?

What is my MySQL Username or Database Name?

MySQL says I have too many connections.

How do I check how much disk space my database is using?

A MySQL MYI table has errors in it.

Can I connect to MySQL remotely?

Can I connect to my MySQL database from my own computer?

I can't get phpMyAdmin to work.

phpMyAdmin gives SQL syntax error when I try to create table.

How can I use odbc_connect() in my PHP scripts to connect to MySQL?

What kind of database server do you offer?

How many databases do I get?

What am I allowed to do with my MySQL database?

Will we be able to do our own MySQL admin?

How do I import a MySQL dumpfile into my database via phpMyAdmin?

Do you offer MySQL 5?

How do I export a MySQL dumpfile via phpMyAdmin?

Browse Categories:

Getting Started, FTP, Telnet/SSH, Moving Domains, E-mail, Traffic Reports, Mailing Lists, Apache, PHP, CGI, Other Server-Side Scripting, MySQL Database, Imaging Libraries, Other Software, Billing & Terms, Control Panel, E-commerce, Pre-Sales


Tiny Modwest Logo         Copyright 2000-2008 by Modwest, Inc.          About Us    |    Blog    |    Jobs    |    Web Design    |    Contact Us