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.
This is the situation: I have server with linux, and there is two databases
Share
Partial duplicate of this.
In command line there are (at least) two ways to achieve this :
or :
Put your command “CREATE TABLE testas.test …” instead of [mysql commands],
Save this into a bash script “myscript” :
Make it executable by the crontab user
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 🙂