When setting up a website with CiviCRM I named the database in a extremely generic format. How can I rename it with breaking Civi? I tried to export the date and import it to a new database with a different name and change the civicrm.settings.php file but that did not work.

Any suggestions would be helpful.

  • Why would you want to rename the CiviCRM database? I assume you can not re-install and use a different name when installing? Commented Jun 24, 2015 at 15:05
  • 1
    Editing civicrm.settings.php SHOULD work. I routinely move databases from a development to production server, where the database name is different, and the only difference is in civicrm.settings.php. Please update your question with more details about what the error you're receiving is, and what changes you made? Commented Jun 24, 2015 at 15:49
  • 1
    In order for anyone to reply with insight, you'll need to give more details than this about your situation. Eg instead of "that did not work" you might say "when importing the DB I saw error: ...", "the DB loaded but when visiting the site I saw a DB error message: ..." or "the site continued to display data from the original DB" Commented Jun 24, 2015 at 22:17
  • We have a fixed codebase we use for some of our sites. Jon, your comments are exactly what I expected to happen but the site broke. I did this a few weeks back so I am going to try to replicate the exact error and add the details here. Commented Jun 26, 2015 at 4:36
  • 1
    Did you rename your CMS database as well? Are they sharing the same one? If either of these is yes, you might need to change settings.php (on Drupal, or equivalent) too.
    – DaveFF
    Commented Jun 26, 2015 at 9:14

1 Answer 1


This is what works for me but not sure if it is necessary based on the following http://wiki.civicrm.org/confluence/display/CRMDOC/Moving+an+Existing+Installation+to+a+New+Server+or+Location :

  1. Edit civicrm.settings.php with new database info
  2. Delete all template files in templates_c/
  3. Make sure there are no references to civicrm database in drupal setttings.php
  4. Clear database caches and session tables
  • Thanks everyone. The answer by @Sonicthoughts worked like a charm. Cheers. Commented Aug 11, 2015 at 6:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.