1

I have two MySQL databases called LIVE and REPORTS on the same server.

I want to copy the LIVE database and all its contents into the REPORTS database everyday at a specific time frame between 1 am and 5 am.

How could I do this manually and automatically?

4
  • 1
    dev.mysql.com/doc/mysql-utilities/1.5/en/… Commented Nov 4, 2015 at 11:13
  • 1
    this question would probably get better answers at Database Administrators. Commented Nov 4, 2015 at 11:20
  • Thanks. This is to make a manual copy. Can an automatic copy be done? Commented Nov 4, 2015 at 11:25
  • Sure, just use cron or other task scheduler available on your platform. For simple data copy you might even get away with MySQL events Commented Nov 4, 2015 at 11:26

1 Answer 1

1

Assuming you are running a unix like OS , you can run a cron job with mysqldbcopy:

crontab -e

Add your job :

30 2 * * * mysqldbcopy --source=user:pwd@localhost --destination=user:pwd@localhost source_database:cloned_database

This will run every day at 2:30 AM.

Note: Storing credentials in a crontab can result in them leaking to logs, mail, etc ...

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.