Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9178427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:32:56+00:00 2026-06-17T17:32:56+00:00

I want to insert rows from a specific table in a database to another

  • 0

I want to insert rows from a specific table in a database to another database with a bash script. The two databases are on different servers. How can I do that?

I want something like this:

INSERT INTO db1.table1(row1, row2) SELECT row1,row2 FROM db2.table2;

But the databases are on different servers.

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T17:32:57+00:00Added an answer on June 17, 2026 at 5:32 pm

    I think you need to use ssh to execute a remote command and mysldump to get the rows from the remote db and mysql to insert the row to the local db.

    ssh <remoteuser>@<remoteServer> mysqldump -t -u <remoteDbUser> -p<remoteDbPass> <remoteDbName> <remoteDbTable> -w<whereCondition> | mysql -u <localDbUser> -p<localDbPass> <localDbName>

    Pay attenction that:

    1. there is no space between -p and the password.
    2. The -t option avoid the CREATE TABLE sql instruction

    Use the man page for more information about the mysqldump command.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to bulk insert all rows from one table to another. I am
I want to insert a record into a MySQL database table from a formulaire.
I want to insert top 20 ROWS from a table tbl_A in db_A to
I want to copy all rows from table and insert this rows in itself
I want to insert multiple rows into different tables in my database. The statements
I have a number of rows from a database which I want to insert
I want to GROUP and aggregate the rows from one table and insert into
I want to insert 3 rows at a time in a table based on
I want to insert 65545 rows from csv to SQL Server 2008 in C#.net
I want to insert multiple rows from one column by splitting column value. But

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.