Database sync between local and production

I was watching Mark Jaquith’s presentation at WCSF 2013 recently and in the Q&A Mark mentioned something about rsync – after a quick Google I can see this is done via SSH – my question is this: is this something that can be done to a local development environment? Do you still need to copy the database and change configuration, url references etc? For a local setup should I just stick to using a script to change the references?

Solutions Collecting From Web of "Database sync between local and production"

If you have databases reachable from the outside ie: mysql1.example.com you can work on a local development environment connected to that the whole time.

I just found a nice thing to put in wp-config.php to be able to change the host depending on your environment

$host = $_SERVER['HTTP_HOST'];
define( 'WP_HOME', 'http://' . $host );
define( 'WP_SITEURL', 'http://' . $host );

Then there are setups like: