OOzy Pal wrote: > is it possible to sync my website between my web host server and > local server including mysql database? > > If yes, can someone put me in the right direction?
If you have port 3306 access (or, whatever port mysql is listening at on your web host) you can use mysqldump, like so: mysqldump --opt db_name | mysql --host=remote_host -C db_name 'man mysqldump' or http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html for full details, including hints about transactional tables (if you're using those), dealing with more than one database, etc. If you only have FTP access, mysqldump can still help: on the local host: mysqldump --opt db_name > backup-file.sql transfer backup-file.sql to the remote host on the remote host: mysql db_name < backup-file.sql Well-timed cron jobs for these three steps, or a cron job on the remote side that wakes ever minute to look for an indicator file (that you FTP up when the database backup is finished transferring), can make for a descent sync. The above examples come straight from the man page for 'mysqldump'. If you can withstand the downtime, you should also be able to shut down the database on both ends, directly FTP the database files themselves, and start both databases back up. Again, you could use either strict timing or the transfer of sentinel files to control the shutdown, copy, and startup. Using mysqldump is probably better, though, since copying over a backup file means that the databases don't have to be down during the time that the FTP takes place. HTH. -- Andrew Witt Sr. Software Systems Engineer Revol - www.revol.us - Freedom is calling
