Skip to end of metadata
Go to start of metadata

Documentation Search

CiviCRM 4.2 Documentation

Developer Resources

CiviCRM books!

Make sure to check out our Online User/Administrator and Developer Guides! You can also support this project by ordering a hard copy.

Or support us by buying an eBook or hard copy of Using CiviCRM from Packt Publishing.

These instructions assume CiviCRM and Drupal are on separate databases located on the same physical host.

  1. Before making any changes, it is strongly advised that you make backups of your mysql databases and settings.php file.
  2. Make sure you are logged into your Drupal site as the administrator.
  3. Visit Replace <> with the domain of your Drupal site/installation.
  4. You should see a page with output that begins with: "$databases['default']['default']['prefix']= array("

  5. Copy everything inside this box, including the trailing ");" 
  6. Open /sites/default/settings.php for editing from the root directory of the site, typically "public_html" on most servers. (NOTE: This assumes you have a single site installation. The location of the settings file might be different depending on whether or not you have multiple sites)
  7. Find the database connector array. This is where Drupal stores the information regarding the MySQL database and the necessary credentials to connect to it. The array beings with " $databases = array ( " then goes on to include the location and MySQL credentials, as well as additional options.
  8. Paste the output from step 3 here. Be sure to paste it AFTER the trailing ");"

  9. You may need to indicate the default prefix. If you see an error like the one below:

    You need to include an additional line, 'default'  => '<drupaltableprefix>', in your settings.php just after $database ['default']['default']['prefix']= array(. You can find more information on this error at

  10. Save the file. You might want to clear your site cache at this point. 
  11. You should now be able to create views based on CiviCRM data.

Many thanks to Jalama for coding and support!