I updated CiviCRM on Drupal 7 to the latest version (5.70.0) in Production. I then copied the production environment into a development URL on the same server, and updated /sites/default/civicrm.settings.php as well as /sites/default/settings.php to point the Sandbox to the development database.

CIVICRM_UF_DSN, CIVICRM_DSN, $civicrm_root, and CIVICRM_TEMPLATE_COMPILEDIR all now point to the development database.

The development site loads fine a web browser, and when I update data from Drupal, that data gets updated in the Dev database with no problem. But when I try to update something in CiviCRM, such as enable or disable an extension, create a new contact, or even when I go to manually run the cron job against the development environment, I get the following error:

DB Error: insufficient permissions

Then when I go to check the log, I see something like the following, which is clearly using the Production (not the Dev) database user:

[nativecode=1142 ** TRIGGER command denied to user 'production-user'@'localhost' for table 'civicrm_contact']"`

I have cleared caches several times, having deleted files in /sites/default/files/civicrm/templates_c. I have grepped the entire Development codebase for the production-user, and it is nowhere to be seen.

I have tried to rebuild the triggers by going to civicrm/menu/rebuild?reset=1&triggerRebuild=1, but that produces the same error. I have also tried to rebuild the menu & clear the cache from the web UI, but that also produces the same error.

How can I track down why the Development copy of this website is still somehow trying to use the Production database user (and is it still somehow trying to connect to the prod database too)?

1 Answer 1


You will need to export the database without triggers and import them back and rebuild the trigger

mysqldump -umysqlusername -p --skip-triggers dbname > dbname.mysql

drop database dbname;

create database dbname;

mysql -umysqlusername -p dbname < dbname.mysql

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.