[thelist] Copying mySQL DB's

Mike Migurski mike-evolt at teczno.com
Sat Aug 23 21:26:14 CDT 2003


>...wondering if it's possible to copy a mySQL database to a webserver
>after you've made it on your test server.  The lack of a sinlge access
>type file is what is confusing me a little.  Is it as simple as copying
>over to the web server then pointing to it using the server admin?.
>Thanks for your help.

MySQL has an included program called mysqldump, whose job is to generate
the SQL commands needed to create a database. So, a typical way (in a
unix-like OS) to move a database from one place to another might be to
capture the output of mysqldump to a file, and then source that file into
a different database.

`man mysqldump` for more info; I usually use commands such as these:
  % mysqldump --complete-insert --add-drop-table db_name > db_name.mysql
  % mysql another_db_name < db_name.mysql

PostgreSQL has a similar utility called pg_dump, and it is used in the
same manner.

---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca            http://mike.teczno.com/contact.html



More information about the thelist mailing list