Copy a mysql database from one server to another PHP cron Job automated -
ok first off not backup job, , know using phpmyadmin , on.
what have live server , test server, people work on live one, modifying it. want database on live server copied test server every night.
does have php script run either copy down whole thing (or @ least specific tables)? i'm not confident using command line if there way of doing way pretty specific instructions :p
i have dug around seems suggesting doing manually or using third party tools.
any appreciated.
you this:
in mysql host machine:
1- create .sh file 2- inside of sh, put: - mysqldump -u myuser -p mypass mydatabasename > mydumpfile.sql - scp mydumfile.sql user@remote_host:remote_dir 3- add sh cron job, daily execute (or meets requeriments)
in remote machine:
1- 1 sh script file(mysqldumpfile.sql) in specific dir 2- line : mysql -u remotemysqluser -p remotemysqlpass database < mydumpfile.sql 3- rm mydumpfile.sql 4- add sh on daily cron 1 or 2 hours past host cron.
Comments
Post a Comment