• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 487
  • Last Modified:

MySQL on linux - export/import best practice

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?  
0
ipconfig610
Asked:
ipconfig610
1 Solution
 
wesly_chenCommented:
Assumption:
- 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


0
 
raysonleeCommented:
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.
0
 
amarjitsCommented:
raysonlee is right...

another one you can use is:

EMS SQL Manager for MySQL

a very nice tool to have.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now