optikalefx Posted October 11, 2010 Share Posted October 11, 2010 I need to write a cron job that will sync 2 databases. Is there a quick way to write an export from one database for import into another? Or do i manually have to write the select statements per table, format them as insert ignore strings, then execute them on the other database? Thanks guys! Quote Link to comment https://forums.phpfreaks.com/topic/215593-using-php-to-export-from-one-db-to-another/ Share on other sites More sharing options...
trq Posted October 11, 2010 Share Posted October 11, 2010 You wouldn't use php for this. Simply execute the commands directly from your crontab. Export: mysqldump -uYOURUSERNAME -pYOURPASS DBNAME > dump.sql Import: mysql -uYOURUSERNAME -pYOURPASSWORD DBNAME < dump.sql Quote Link to comment https://forums.phpfreaks.com/topic/215593-using-php-to-export-from-one-db-to-another/#findComment-1120971 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.