MySQL Data migration from one server box to another


Here’s a quick way to move data from one MySQL server to another

Let source box be ServerOne, and the target box be ServerTwo. (user-names and schema names are indicative) –

  1. On ServerOne,
    1. mysqldump -u username -p db_name > data-dump.sql  (provide password when asked)
    2. scp data-dump.sql serverTwoUsername@ServerTwo:~/
  2. On ServerTwo
    1. mysql -u username -p
    2. create schema schema-name;
    3. exit
    4. mysql -u username -p -h localhost schema-name < data-dump.sql
    5. verify
      1. mysql -u username -p
      2. use schema-name;
      3. show tables;

Should be done.

Leave a Reply

Your email address will not be published. Required fields are marked *


* Copy This Password *

* Type Or Paste Password Here *

67,683 Spam Comments Blocked so far by Spam Free Wordpress

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>