Maybe I've been staring at this too long and am missing something obvious. I do this duplicating of the live site onto the dev site often, but today it's broken.

I created a copy of our site. It's on Drupal 7 and CiviRM 4.7.22. I can log into the site and visit CiviCRM. When I try to register for an event, it fails with errors. I turned on all the error reporting. It shows it is failing because it is using the wrong database user - it's trying to use the database user for the live site instead of this dev one. Everything is correct in the settings file - it links to the right database user. So where else should I be looking to find a place where it is looking at the wrong database user? Thanks!

UPDATE: Well, I ran an update to 4.7.30 and now it's fixed.

  • You mentioned 'settings file' but didn't specifically say both settings.php and civicrm.settings.php (assuming both would require such a change)
    – petednz - fuzion
    Feb 15 '18 at 23:24
  • Both are correct, as they are the original files (I don't copy over those from the live site). I checked them anyway just to make sure, but both are correct. Whatever it was somehow cleared up in the update. Feb 15 '18 at 23:41
  • maybe it needed caches clearing which the upgrade takes care of?
    – petednz - fuzion
    Feb 16 '18 at 3:43
  • I must've cleared the cache more than a dozen times. So unless the button telling it to clear the cache isn't working, it's hard to believe it's that. Feb 17 '18 at 11:59

While this is an older thread I recently found myself in the exact same situation. (We copied live to dev and couldn't update anything - the wrong database user error kept popping up.)

Turns out that while the settings file database user was correct, the triggers in the database still had a reference to the live database user (the trigger definer). While I'm exploring if there's a way to update those trigger definers - I assume that in your case running a database upgrade did that for you.

EDIT: (thanks to Demerit) to fix the wrong database user, I rebuilt the database triggers using the Civi URL command and all is good.

  • 2
  • OMG @demerit you are a life-saver. I didn't know it was that easy, I was scouring mysql references to try and do it.
    – RayWright
    Aug 27 '19 at 19:41
  • Cool. It seems to come up once in a while. I will add it to a rainy-day todo list to make a system status check that checks if the trigger definer is different than the civicrm.settings.php user and then points you to the rebuild link.
    – Demerit
    Aug 27 '19 at 19:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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