Results 1 to 11 of 11

Thread: Moving MySQL database from one computer to another

  1. #1

    Thread Starter
    Addicted Member kill_bill_gates's Avatar
    Join Date
    Oct 2004
    Posts
    222

    Moving MySQL database from one computer to another

    Hello,

    I may be asking this in the wrong category but since I use MySQL with PHP I think this is the closest. How can I move MySQL databases from one computer to another? If I simply copy the whole MySQL folders or some of its folders and paste it on the other computer would it be sufficient?

    Thanks
    "Quis custodiet ipsos custodes?"
    Juvenal
    Mete the Hun wanted to live in peace with the Chinese. So he gave the Chinese Emperor his favorite horse, best swords in his armory, and lots of other cool stuff. But then the Chinese Emperor asked for one thing. A useless land through the north. It was a small, useless, unproductive, uninhabited piece of land. But Mete the Hun's answer was certain:
    I gave you horses, weapons and much more which belonged to me. But the lands are not mine, it's my nation's and I'm ready to fight, kill and die for just an inch my country
    -=Joey Jordison R0CKS!! =-

  2. #2
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: Moving MySQL database from one computer to another

    it would be best to make a MySQL dump of all the contents. I'm not sure if copying the folders would be good enough.

    you can make a MySQL dump using various administration programs/interfaces, including phpMyAdmin (which is what I would suggest). There's also a command that will do this for you, I believe, but it seems to escape me at this time. there was another thread about this a couple of months ago I believe, so if you search this forum for "sql dump" or just "dump," you might be able to find some references.

  3. #3
    Junior Member
    Join Date
    Mar 2006
    Posts
    24

    Re: Moving MySQL database from one computer to another

    I will suggest, export all data to SQL (maybe use phpMyAdmin), and import into new database

  4. #4
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: Moving MySQL database from one computer to another

    that's what a MySQL dump is.

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Moving MySQL database from one computer to another

    Code:
    $ mysqldump -u <user> -p<password> <database> > dumpfile.sql
    The last > is literal. That's the command on Unix systems.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  6. #6
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Moving MySQL database from one computer to another

    And on Windows, use the --result-file switch.
    http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html

  7. #7
    Fanatic Member modpluz's Avatar
    Join Date
    Sep 2005
    Location
    Lag, NG
    Posts
    633

    Re: Moving MySQL database from one computer to another

    Quote Originally Posted by penagate
    And on Windows, use the --result-file switch.
    http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html
    please how do i get through this dump on windows?

    as the mysqldump returned an empty result.

    i have MySQL 5.0.51b

    thanks
    If you want the rabbit to hop, move the carrot - Paul Kellerman(Prison Break)

    onError GoTo http://vbforums.com



    My Bits:
    VB6: Change Column Name in MS ACCESS

  8. #8
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: Moving MySQL database from one computer to another

    Quote Originally Posted by modpluz
    please how do i get through this dump on windows?

    as the mysqldump returned an empty result.

    i have MySQL 5.0.51b

    thanks
    This command will produce a mysqldump on Windows:

    Code:
    "C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqldump" -u myuser --password=mypass mydbname > C:\database.sql
    Be sure to change the mysql path to your path and the user/pass.
    Last edited by the182guy; Nov 13th, 2008 at 11:54 AM.
    Chris

  9. #9
    Frenzied Member StrangerInBeijing's Avatar
    Join Date
    Mar 2005
    Location
    Not in Beijing
    Posts
    1,666

    Re: Moving MySQL database from one computer to another

    Did the advice work out for you? Having same troubles.
    Install and Configure Eclipse For both Java and PHP development
    Accessible Ajax/jQuery Forms Degrade gracefully with JavaScript Disabled

  10. #10
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: Moving MySQL database from one computer to another

    I editted my post with different code. I have just tested this on my system which worked:

    Code:
    "C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqldump" -u myuser  --password=mypass db > C:\database.sql
    That will create an SQL file with the dump in, in c:\

    Be sure to change the path to your mysql bin directory. Change myuser to your username, mypass to your password and mydb to your database name.
    Chris

  11. #11
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Moving MySQL database from one computer to another

    If you specify the -p option with no password you will be prompted to type it into the standard input of the mysqldump utility which is safer than having it logged in your shell's history.

Posting Permissions

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



Click Here to Expand Forum to Full Width