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

  • SEARCH
  • Home
  • 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 6956019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:48:48+00:00 2026-05-27T14:48:48+00:00

This is the situation: I have server with linux, and there is two databases

  • 0

This is the situation: I have server with linux, and there is two databases in it. I need to make a cron job to transfer some data from db1 to db2. The thing is i need this:
db1->table1->column1 + db1->table1->column2 + db1->table2->column1 TRANSFER TO db2->table1(create table) with these three fields. Can anyone help me to form a proper cron job command? I know how to transfer tables between databases, but this is far more complicated.

  • 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-05-27T14:48:49+00:00Added an answer on May 27, 2026 at 2:48 pm

    Partial duplicate of this.

    In command line there are (at least) two ways to achieve this :

    mysql -u[user] -p[pass] -e "[mysql commands]"   
    

    or :

    mysql -u[user] -p[pass] <<QUERY_INPUT   
    [mysql commands]   
    QUERY_INPUT   
    

    Put your command “CREATE TABLE testas.test …” instead of [mysql commands],
    Save this into a bash script “myscript” :

    #!/bin/bash
    user=$1
    pwd=$2
    mysql -u"$user" -p"$pwd" <<QUERY_INPUT   
    [mysql commands]   
    QUERY_INPUT  
    

    Make it executable by the crontab user

    chmod +x myscript
    

    Then it depends on the distro you’re using for the cronjob.
    For example in Debian’s-like distro, you don’t need to do anything else than putting your script into the right directory. For example, il you wish the script to be run daily, move the file into /etc/cron.daily.
    Just take care in this case not to forget to call the cronjob with the 2 datas user and pwd 🙂

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

Sidebar

Related Questions

This is my situation:     I have a linux server/media center with a
In this situation I have two models, Comment and Score. The relationship is defined
I have this situation: There are a login page with a login form (form
So, I have this situation where I need to see if an object is
this is my situation: I have two org.w3c.dom.Document created from two xml files. What
I have a client server situation in which I receive data using read(socket, char_buf,
Here is the situation: I have a huge data set that I need quick
Hi I have this situation: SQL Server 1 (production) with obj A, B, C
This is the situation: We have some binary files (PDFs, PPTs, ZIPz, etc.) stored
During coding I frequently encounter this situation: I have several objects ( ConcreteType1 ,

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.