MySQL on linux - export/import best practice

Posted on 2011-10-11
Last Modified: 2012-05-12
I am new to MySQL CLI and working with a database running on a Linux system.  I would like to export one of the tables in a database so I can view and update on another server.  Once I have updated the fields that need updating I will need to import this table back to its original location.  can someone provide me with some sample syntax to do this?  
Question by:ipconfig610
    LVL 8

    Expert Comment

    LVL 38

    Accepted Solution

    - table to export on database server dbsvr1 (server name) - table1 on database "db1"
    - database server to import, dbsvr2

    Export (using mysqldump)
    Command on dbsvr1
    mysqldump -u root -p <db root password> db1 table1 > db1_table1.sql

    Import (using mysql)
    Command on dbsvr2
    mysql -u root -p <dbsvr2 db root password>  < db1_table1.sql

    Once you update on dbsvr2, then you can export out from dbsvr2 and import back to dbsvr1

    On dbsvr2
    mysqldump -u root -p <dbsvr2 db root password> db1 table1 > db1_table1_new.sql

    On dbsvr1
    mysql -u root -p <dbsvr1 db root password>  < db1_table1_new.sql


    Expert Comment

    LVL 9

    Expert Comment

    If you don't feel comfortable with the command line interface, you can use MySQL Workbench on a Windows machine and connect to those servers remotely for executing the import/export function.
    Other graphical database tools, such as NaviCat, can do the job for you as well.

    Expert Comment

    raysonlee is right...

    another one you can use is:

    EMS SQL Manager for MySQL

    a very nice tool to have.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension ( This reminded me of questions tha…
    Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
    Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
    Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now