Sure, you can pull this off manually by grabbing the database, reloading your local, and updating your Drupal site's config; but why not add a little automation to help out?
Using a Shell Script with Drush
Recently I was setting up a local environment and had the opportunity to use a script created by Colan Schwartz. If you are running Linux or OSX then you can easily use this script and modify it to your own needs. If you haven't done much shell scripting, or you use an alternative OS such as Windows, you may want to get a quick overview from howtogeek.com
Now that you're an expert on shell scripting you should check out Colan's very well documented script on gitlab. You may need to update the command path variables
# Set command paths.
DRUSH=/usr/local/bin/drush
GZIP=/bin/gzip
CUT=/usr/bin/cut
GREP=/bin/grep
ECHO=/bin/echo
DATE=/bin/date
SUDO=/usr/bin/sudo
CHOWN=/bin/chown
ID=/usr/bin/id
MKDIR=/bin/mkdir
Also, the default USER_WEB settings may be incorrect for you setup and your web server user is not one of: php-fpm, nginx, apache, or www-data.
The MODULES_DISABLE variable controls what modules are disabled on your local environment, and you can modify MODULES_ACQUIA and MODULES_ADVAGG with your own variables and module lists.
If you'd like to test out the script make sure you have a backup of your code and databases. Once you get the base settings adjusted for your setup, updating the settings for subsequent sites will be quite easy. Running the script executes the following commands:
- Saves a cache-cleared dump of the destination database (DB) as a backup.
- Overwrites the destination DB with the source's.
- Updates the DB schema.
- Imports the latest configuration saved in code.
- Disables modules that shouldn't be enabled during development.
- Enables modules that are helpful for development.
- Clears all caches.
- Overwrites the destination's files directory with the source's.
- Runs cron.
I hope this helps your development workflow, if you were able to adjust the script for your specific setup please share your results. Happy scripting!
Some additional items:
If all you need to do is rebuild your local dev environment then check out this cool project which turns the process into a simple drush command: Drush Rebuild.
Here are a few other scripts that you might find useful or inspirational: