Answers.Body: <p>Maybe you do not have ssh access and MySQL access. But this can also done from the user interface. To rebuild the triggers use the url:</p>
  
  <pre><code>http://&lt;&lt;servername&gt;/civicrm/menu/rebuild?reset=1&amp;triggerRebuild=1
  </code></pre>
  
  <p>(This is documented in the <a href="https://docs.civicrm.org/sysadmin/en/latest/troubleshooting/#trigger-rebuild" rel="noreferrer">system admin manual</a>.)</p>
  
  <p>Recreating the Case Views can be done by disabling the case module and enabling it again (Goto <em>Administer -> System Settings -> Components</em>)</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-01T13:21:12.773Z
Answers.Text: This worked for me !!! thanks
Answers.UserDisplayName: harshal
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-25T09:16:42.833Z
Answers.LastActivityDate: 2018-08-25T09:16:42.833Z
Answers.UserDisplayName: Kainuk - CiviCooP
Answers.Body: <p>did you dump the old site and restored it on the new server?</p>
  
  <p>check that mysql dump file, it should contain the olduser string, replace it in that file with the new one before doing the restore and it should work fine.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-14T07:44:09.193Z
Answers.LastActivityDate: 2016-01-14T07:44:09.193Z
Answers.UserDisplayName: Xavier
Answers.Body: <p>Similar to the accepted answer, in my case there were two case views which contained the incorrect definer information. Performed the alter query on the view and it was fixed.</p>
  
  <p>Those view names were - <code>civicrm_view_case_activity_recent</code> and <code>civicrm_view_case_activity_upcoming</code>. Steps performed -</p>
  
  <ul>
  <li><p>Execute this statement.</p>
  
  <pre><code>SHOW CREATE VIEW civicrm_view_case_activity_recent.
  </code></pre></li>
  <li><p>Copy the <code>create view</code> syntax.</p></li>
  <li>replace incorrect username with the correct one.</li>
  <li>replace <code>CREATE</code> word with <code>ALTER</code>.</li>
  <li>Execute the query and repeat the steps for <code>civicrm_view_case_activity_upcoming</code>.</li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-10-06T06:09:12.970Z
Answers.LastActivityDate: 2017-10-06T06:09:12.970Z
Answers.UserDisplayName: jitendra - fuzion
Answers.Body: <p>The database triggers and the views can be recreated by using some code from the installation procedure. You can execute them with <code>drush</code>. To rebuild the triggers do</p>
  <pre><code>drush cvapi System.flush triggers=1 
  </code></pre>
  <p>This also rebuilds the <code>civicrm_strip_non_numeric</code>. Unfortunately this does not work for the views. But this can be done with:</p>
  <pre><code>drush eval 'civicrm_initialize();CRM_Case_BAO_Case::createCaseViews()'
  </code></pre>
  <p>On other CMS systems you can do the same with <code>cv</code>:</p>
  <pre><code>cv api3 System.flush triggers=1 
  cv ev 'CRM_Case_BAO_Case::createCaseViews()'
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-24T15:53:32.593Z
Answers.LastActivityDate: 2021-11-05T11:49:15.697Z
Answers.LastEditDate: 2021-11-05T11:49:15.697Z
Answers.UserDisplayName: Kainuk - CiviCooP
Answers.Body: <p>Xavier, your answer would have worked if I had had the luxury of re-importing. 
  It turns out that there is a single function in the CiviCRM DB that for some reason uses a hard-coded username and password. I went in to the DB, located the "civicrm_strip_non_numeric" function and updated the username and password. Problem solved.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-21T14:46:35.977Z
Answers.LastActivityDate: 2016-01-21T14:46:35.977Z
Answers.UserDisplayName: Derek
Body: <p>I recently moved the site to a new server and changed from a remote to a local MySQL server with different credentials. Most things seem to be working fine, but even though I've flushed caches, editing phone numbers leads to an AJAX "Network Error" message and the following in my logs: </p>
  
  <pre>$Fatal Error Details = Array (
    [callback] => Array (
      [0] => CRM_Core_Error
      [1] => handle )
    [code] => -1
    [message] => DB Error: unknown error
    [mode] => 16
    [debug_info] => INSERT INTO civicrm_phone (contact_id , location_type_id , is_primary , is_billing , phone , phone_ext , phone_type_id )
      VALUES ( 200025 , 2 , 1 , 0 , '6464646464' , NULL , 1 )
      [nativecode=1449 ** The user specified as a definer ('OLDUSER'@'%') does not exist]
    [type] => DB_Error
    [user_info] => INSERT INTO civicrm_phone (contact_id , location_type_id , is_primary , is_billing , phone , phone_ext , phone_type_id )
      VALUES ( 200025 , 2 , 1 , 0 , '6464646464' , NULL , 1 )
      [nativecode=1449 ** The user specified as a definer ('OLDUSER'@'%') does not exist]
    [to_string] => [db_error: message="DB Error: unknown error"
      code=-1
      mode=callback
      callback=CRM_Core_Error::handle prefix=""
      info="INSERT INTO civicrm_phone (contact_id , location_type_id , is_primary , is_billing , phone , phone_ext , phone_type_id ) VALUES ( 200025 , 2 , 1 , 0 , '6464646464' , NULL , 1 ) [nativecode=1449 ** The user specified as a definer ('OLDUSER'@'%') does not exist]"]
  )</pre>
  
  <p>OLDUSER is nowhere in my configs and I have run both <code>drush cc all</code> and <code>drush cvapi system.flush</code>. Any ideas?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-06-24T03:25:34.163Z
Comments.Text: See also http://civicrm.stackexchange.com/questions/619/why-do-i-get-access-denied-you-need-at-least-one-of-the-super-privileges-f/620#620 which has commands to strip `DEFINER` info from a DB dump.
Comments.UserDisplayName: Chris Burgess
Tags: <database><error><migration>
Title: Migration error: “The user specified as a definer does not exist”
ThreadText: # Migration error: “The user specified as a definer does not exist”
  
  (Asked by: username_0 on 2016-01-14)
  
  I recently moved the site to a new server and changed from a remote to a local MySQL server with different credentials. Most things seem to be working fine, but even though I've flushed caches, editing phone numbers leads to an AJAX "Network Error" message and the following in my logs:
  
  ```
  $Fatal Error Details = Array (
    [callback] => Array (
      [0] => CRM_Core_Error
      [1] => handle )
    [code] => -1
    [message] => DB Error: unknown error
    [mode] => 16
    [debug_info] => INSERT INTO civicrm_phone (contact_id , location_type_id , is_primary , is_billing , phone , phone_ext , phone_type_id )
      VALUES ( 200025 , 2 , 1 , 0 , '6464646464' , NULL , 1 )
      [nativecode=1449 ** The user specified as a definer ('OLDUSER'@'%') does not exist]
    [type] => DB_Error
    [user_info] => INSERT INTO civicrm_phone (contact_id , location_type_id , is_primary , is_billing , phone , phone_ext , phone_type_id )
      VALUES ( 200025 , 2 , 1 , 0 , '6464646464' , NULL , 1 )
      [nativecode=1449 ** The user specified as a definer ('OLDUSER'@'%') does not exist]
    [to_string] => [db_error: message="DB Error: unknown error"
      code=-1
      mode=callback
      callback=CRM_Core_Error::handle prefix=""
      info="INSERT INTO civicrm_phone (contact_id , location_type_id , is_primary , is_billing , phone , phone_ext , phone_type_id ) VALUES ( 200025 , 2 , 1 , 0 , '6464646464' , NULL , 1 ) [nativecode=1449 ** The user specified as a definer ('OLDUSER'@'%') does not exist]"]
  )
  ```
  
  OLDUSER is nowhere in my configs and I have run both `drush cc all` and `drush cvapi system.flush`. Any ideas?
  
  **Tags:** database, error, migration
  
  > **Comments:**
  > **username_1**: See also http://civicrm.stackexchange.com/questions/619/why-do-i-get-access-denied-you-need-at-least-one-of-the-super-privileges-f/620#620 which has commands to strip `DEFINER` info from a DB dump.  
  
  ---
  
  ## 5 answers
  
  ### Answer by username_0 on 2016-01-21. Score: 3 | Accepted answer
  
  username_4, your answer would have worked if I had had the luxury of re-importing.
  It turns out that there is a single function in the CiviCRM DB that for some reason uses a hard-coded username and password. I went in to the DB, located the "civicrm\_strip\_non\_numeric" function and updated the username and password. Problem solved.
  
  
  ---
  
  ### Answer by username_2 on 2018-08-25. Score: 6
  
  Maybe you do not have ssh access and MySQL access. But this can also done from the user interface. To rebuild the triggers use the url:
  
  ```
  http://<<servername>/civicrm/menu/rebuild?reset=1&triggerRebuild=1
  
  ```
  
  (This is documented in the [system admin manual](https://docs.civicrm.org/sysadmin/en/latest/troubleshooting/#trigger-rebuild).)
  
  Recreating the Case Views can be done by disabling the case module and enabling it again (Goto *Administer -> System Settings -> Components*)
  
  > **Comments:**
  > **username_3**: This worked for me !!! thanks  
  
  ---
  
  ### Answer by username_4 on 2016-01-14. Score: 2
  
  did you dump the old site and restored it on the new server?
  
  check that mysql dump file, it should contain the olduser string, replace it in that file with the new one before doing the restore and it should work fine.
  
  
  ---
  
  ### Answer by username_5 on 2017-10-06. Score: 2
  
  Similar to the accepted answer, in my case there were two case views which contained the incorrect definer information. Performed the alter query on the view and it was fixed.
  
  Those view names were - `civicrm_view_case_activity_recent` and `civicrm_view_case_activity_upcoming`. Steps performed -
  
  * Execute this statement.
  
    ```
    SHOW CREATE VIEW civicrm_view_case_activity_recent.
  
    ```
  * Copy the `create view` syntax.
  * replace incorrect username with the correct one.
  * replace `CREATE` word with `ALTER`.
  * Execute the query and repeat the steps for `civicrm_view_case_activity_upcoming`.
  
  
  ---
  
  ### Answer by username_2 on 2018-08-24. Score: 1
  
  The database triggers and the views can be recreated by using some code from the installation procedure. You can execute them with `drush`. To rebuild the triggers do
  
  ```
  drush cvapi System.flush triggers=1 
  
  ```
  
  This also rebuilds the `civicrm_strip_non_numeric`. Unfortunately this does not work for the views. But this can be done with:
  
  ```
  drush eval 'civicrm_initialize();CRM_Case_BAO_Case::createCaseViews()'
  
  ```
  
  On other CMS systems you can do the same with `cv`:
  
  ```
  cv api3 System.flush triggers=1 
  cv ev 'CRM_Case_BAO_Case::createCaseViews()'
  
  ```
  
  
  ---
  
  