Beefy Boxes and Bandwidth Generously Provided by pair Networks chromatic writing perl on a camel
There's more than one way to do things
 
PerlMonks  

What's the best way to copy LOTS! of records between 2 mySQL servers?

( #29165=categorized question: print w/ replies, xml ) Need Help??
Contributed by whahoo on Aug 23, 2000 at 09:00 UTC
Q&A  > database programming


Answer: What's the best way to copy LOTS! of records between 2 mySQL servers?
contributed by Russ

MySQL also has

SELECT * FROM skr INTO OUTFILE 'filename'; LOAD DATA INFILE "filename" INTO TABLE skr;
The MySQL team says this is a very fast way to copy data from one server to another.

Check the MySQL Manual for more info.

Russ

Answer: What's the best way to copy LOTS! of records between 2 mySQL servers?
contributed by Anonymous Monk

mysqldump -u<username> -p<password> \ -h<remote_host> -c <databasename> | mysql \ -u<localuser> -p<localpassword> newdatabase you may add --add-drop-table on the left side of the pipe if the database tables already exists locally and -C if you are on a slow connection (uses a compressed protocol for data tranfer)

Please (register and) log in if you wish to add an answer



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others about the Monastery: (14)
    As of 2014-04-18 19:25 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      April first is:







      Results (471 votes), past polls