Copying a database

Gerhard Häring gh_pythonlist at gmx.de
Sat Jun 1 19:51:31 CEST 2002


* Billy Ng <kwokng at earthlink.net> [2002-06-01 16:37 +0000]:
> I need you guys help on mysql again.  I need to push my python program to
> production now, but I don't want to recreate the mysql database on the
> production box.  I want to copy the database from the development box to
> production box.. Would anybody please tell me how to do it, thanks!

Use mysqldump to export a dump. Then use mysql to import the dump to the
remote database. Like this:

mysqldump {your options here} >dumpfile   # redirect to dumpfile
mysqldump {your options here} -h remotehost <dumpfile   # read from dump

If the database is not very big, this approach works fine. For
multi-gigabyte databases, I'm sure there is a more efficient approach
;-)

The MySQL manual should describe these commands in detail.

Gerhard
-- 
This sig powered by Python!
Außentemperatur in München: 20.0 °C      Wind: 2.4 m/s





More information about the Python-list mailing list