Results 1 to 9 of 9
  1. #1
    Join Date
    May 2004
    Posts
    11

    Unanswered: Copying a database

    Helloo Everyone,

    I would like to copy a database so I can relocate it and the php pages onto another system. What command do I use to copy the database?

    Thanks!

  2. #2
    Join Date
    Apr 2005
    Location
    Baltimore, MD
    Posts
    297
    You need to dump the database data and table structures into a file. Then read that file into MySQL on the new server. I've never dumped using the command line, but check the mysql pages for detailed info and which options to use. To read back in, just use '<' or 'source' from the shell.

    The most common use of mysqldump is probably for making a backup of an entire database:

    shell> mysqldump --opt db_name > backup-file.sql

    You can read the dump file back into the server like this:

    shell> mysql db_name < backup-file.sql

    Or like this:

    shell> mysql -e "source /path-to-backup/backup-file.sql" db_name
    from:http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html

  3. #3
    Join Date
    Oct 2003
    Posts
    63

  4. #4
    Join Date
    Mar 2004
    Posts
    33

    Lightbulb

    Hi,

    Try to export the database through mysqldump or any available GUI's or check the option transfer database available in the major mySQL managers.


    Regards,

  5. #5
    Join Date
    May 2004
    Posts
    11

    Angry Database

    This function does not seem to work.....do I log into mysql or do I complete this from shell? My datbase name is accm. Does that help?

  6. #6
    Join Date
    Apr 2005
    Location
    Baltimore, MD
    Posts
    297
    From the shell:

    mysqldump --opt accm > backup-file.sql

    You may also need to specify the host, username, password, etc. Check out http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html for more info on that and which options you may want to use.

  7. #7
    Join Date
    May 2004
    Posts
    11
    -bash mysqldump: command not found

    How do I install this?

  8. #8
    Join Date
    Apr 2005
    Location
    Baltimore, MD
    Posts
    297
    mysqldump should already be included. Make sure the MySQL bin directory is in your PATH environment variable. For bash, I believe the command to set is 'export'...:
    export PATH=$PATH:/pathto/mysqlbin/
    Or try running the command from the bin directory.

  9. #9
    Join Date
    Dec 2005
    Posts
    1
    Besides mysqldump, could anyone tell me another methods to backup the entire database coz I might not know where the path of mysqldump is in other server. Thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •