[Drupal] How to sync live and development sites?

By | 06 th Jan 2015 | 2 min read

Syncing means importing all files, permissions and data's from master to the development site, so that we have a two copies of live sites to test our new developments. In Drupal, its very easy to create versions of websites using this syncing process. Once the site is live to Production, the above process helps to fetch the sites data in the current scenario and to update few more features in the live site.
I had a task to sync live database to development site's and came across some issues while syncing live database with the dev database.

The following commands could be used to import the database from live server

Before proceeding to do anything on live server, it's a good practice to always keep a db backup and file backups.

  • To backuping up live database
     mysqldump -u username -ppassword  database_name | gzip > filname.sql.gz
  • Import the live database to dev server
     gunzip < filename.sql.gz | mysql -u dev_username -pdev_password dev_databasename

The following errors occurs after syncing in development website.

  • "The website met an unexpected error. Please try again later."
  • PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'status', ...line 382 of /modules/filter/filter.module
  • PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column .....line 187 of /home/xxxxx/public_html/sites/all/modules/entity/includes/entity.controller.inc).

The above issue can be fixed by disabling the following in the sites.

  1. Disable boost module
    drush pm-disable boost
  2. Disable memcached module
    drush pm-disable memcached
  3. Disable css/js aggregations
    drush vset preprocess_js 0 --yes
            drush vset preprocess_css 0
            drush vset preprocess_js 0
            drush cc css+js
  4. Cleared all cached data
    drush cc all

Hope the above helps you to sort the issues after syncing live and dev database.