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.

Kj
Kj [/.] Sreekumar programs computers as a hobby and profession. Into programming from his school days, Sree uses Codemarvels to key in facts and fixes he finds interesting while working on different projects. Some of the articles here give away a few shades of his philosophical leanings too.

Leave a Comment

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