After having put a lot of time into customizing a CiviCRM installation, I want a way to replicate the configuration / customization / installed-extensions, but start from scratch on the contacts (so that newly added contacts -- after the admin contact and organization -- have contact-ids of 3,4,5,...). Deleting all contacts via the UI doesn't seem to "reset" the next-contact ID counter.

Perhaps one way this could be possible is if there were a means by which all configuration / extensions could be backed up and restored, independent of the data in the system (e.g. contacts, memberships, contributions, etc.). Is this possible somehow? Or is there another way to achieve my goal of "starting over" with non-configuration data?

  • Why do you want to start with a new contact id? If there is a need to have a unique but meaningful contact number you could also use the Identity Tracker extension: github.com/systopia/de.systopia.identitytracker Jun 6, 2018 at 8:59
  • @JaapJansma-CiviCooP a "reset" contact ID isn't the main goal, but rather a fresh CiviCRM database that doesn't have any data-elements in it left-over from previous use of CiviCRM -- so really this goes beyond just contacts to anything that isn't configuration related data.
    – Mark
    Jun 6, 2018 at 14:47

1 Answer 1


I would suggest to perform deletion of contact from UI and then reseting the auto increment value through mysql command. Truncating database might loose contact that are not suppose to be deleted like logged in contact id or Default organization contact id or they might be possible to have orphan data for contacts if we directly truncate the table. Here is what i would do

  1. Find Contact
  2. Select All contact
  3. From Action list i will select 'Delete Contact permanently'

Shell in for mysql or in phymyadmin through web and run ALTER TABLE civicrm_contact AUTO_INCREMENT = 1

Note: Backup database before deleting contacts.



  • While this is a bit better than directly removing entries via SQL queries, I am noticing that even after deleting a contact "permanently", there are still residual "Address" entities in the database that were associated with deleted contacts. Is there a way to safely remove these also?
    – Mark
    Jun 6, 2018 at 2:43
  • Those address may be tied to Events. Can you check if all the address have contact_id as NULL and this address are link to civicrm_loc_block Jun 6, 2018 at 18:52
  • I already manually deleted all the address entities via the API explorer, but their contact_id fields were not NULL.
    – Mark
    Jun 7, 2018 at 12:59
  • Ohhh in that case they might have tied up with events not sure though Jun 7, 2018 at 13:06

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.