Answers.Body: <p>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.)</p>
  
  <p>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.</p>
  
  <p>EDIT: (thanks to Demerit) to fix the wrong database user, I rebuilt the database triggers using the Civi URL command and all is good.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-27T19:34:31.130Z
Answers.Text: Try this https://docs.civicrm.org/sysadmin/en/latest/troubleshooting/#trigger-rebuild
Answers.UserDisplayName: Demerit
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-27T19:41:04.000Z
Answers.Text: 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.
Answers.UserDisplayName: RayWright
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-27T19:59:18.763Z
Answers.Text: 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.
Answers.UserDisplayName: Demerit
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-27T19:03:02.350Z
Answers.LastActivityDate: 2019-08-27T19:42:39.163Z
Answers.LastEditDate: 2019-08-27T19:42:39.163Z
Answers.UserDisplayName: RayWright
Body: <p>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.</p>
  
  <p>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!</p>
  
  <p>UPDATE: Well, I ran an update to 4.7.30 and now it's fixed. </p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-02-15T23:24:14.820Z
Comments.Text: You mentioned 'settings file' but didn't specifically say both settings.php and civicrm.settings.php (assuming both would require such a change)
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-02-15T23:41:08.400Z
Comments.Text: 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.
Comments.UserDisplayName: Jenni Simonis
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-02-16T03:43:06.050Z
Comments.Text: maybe it needed caches clearing which the upgrade takes care of?
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-02-17T11:59:18.927Z
Comments.Text: 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.
Comments.UserDisplayName: Jenni Simonis
Tags: <database>
Title: Wrong database user
ThreadText: # Wrong database user
  
  (Asked by: username_0 on 2018-02-15)
  
  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.
  
  **Tags:** database
  
  > **Comments:**
  > **username_1**: You mentioned 'settings file' but didn't specifically say both settings.php and civicrm.settings.php (assuming both would require such a change)  
  > **username_0**: 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.  
  > **username_1**: maybe it needed caches clearing which the upgrade takes care of?  
  > **username_0**: 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.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2019-08-27. Score: 1
  
  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 username_3) to fix the wrong database user, I rebuilt the database triggers using the Civi URL command and all is good.
  
  > **Comments:**
  > **username_3**: Try this https://docs.civicrm.org/sysadmin/en/latest/troubleshooting/#trigger-rebuild  
  > **username_2**: OMG @username_3 you are a life-saver. I didn't know it was that easy, I was scouring mysql references to try and do it.  
  > **username_3**: 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.  
  
  ---
  
  