Answers.Body: <p>Ahh did you upgraded to unstable version of CiviCRM? The last stable release i see is 5.4.1. Try replacing the civicrm code base to 5.4.1 and then update the civicrm_domain.version to 5.4.1 and also truncate all cache tables and anything under template_c folder.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-09T17:41:56.963Z
Answers.Text: That did the trick in short order! Already had installed the 5.4.1 codebase; it was the database that had me flummoxed. But after reading Pradeep's answer, I used phpMyAdmin to "SELECT * FROM `civicrm_domain`" and then "UPDATE `civicrm_domain` SET `version` = '5.4.1' WHERE `civicrm_domain`.`id` = 1;" ... then I used the Civi Admin (Administer / System Settings / Cleanup Caches and Update Paths) to finish up. Everything is good now, so THANK YOU! :)
Answers.UserDisplayName: Prónay
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-09T15:33:32.123Z
Answers.LastActivityDate: 2018-09-09T15:33:32.123Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>Applied the 5.3.2 patch to our WP site yesterday, and in so doing upgraded the database to 5.6.alpha1. After doing this, multiple components (Contributions, Events, Mailing) became unusable. Trying to access these caused 500 (server) errors. Meanwhile, Civi 5.4.1 dropped, so I replaced the 5.3.2 patched code with 5.4.1 -- but couldn't update the database, because it was still 5.6.alpha1.</p>
  
  <p>"No problem," I thought -- I can restore the WP database from a backup. But the only backup I had was from after the 5.3.2 patch, i.e. in the 5.6.alpha1 state. And as luck would have it, the hosting provider's backup on the server was corrupt and couldn't be restored.</p>
  
  <p>So here's my dilemma. System Status tells me I need to "determine the correct version corresponding to your current database state." Should I try to manually alter the working database so it aligns with the 5.4.1 codebase (and if so, how do I even begin to do that)? Or do I try to reapply the 5.3.2 patch and hope to somehow fix the server errors? Or do I apply a different codebase entirely?</p>
  
  <p>The error message also suggests fixing the file civicrm-version.php -- so I set the 'version' value to '5.4.1' but no luck. I still get this: </p>
  
  <pre><code>Your database is marked with an unexpected version number: 5.6.alpha1. The v5.4.1 codebase may not be compatible with your database state. You will need to determine the correct version corresponding to your current database state. You may want to revert to the codebase you were using until you resolve this problem. OR if this is a manual install from git, you might want to fix civicrm-version.php file.
  </code></pre>
  
  <p><strong>How best do I fix this?</strong> And since Civi appears to be running okay right now despite having different codebase and database versions, <strong>is it possible the database version is somehow misidentified</strong> -- that the DB version is really 5.4.1, but identifies itself as 5.6.alpha1? Images (bottom) showthe current DB structure.</p>
  
  <p>As an aside, I've just learned a valuable lesson. <strong>Always store a DB backup locally before starting an upgrade</strong>, even when two automatic backup systems are running. If I had backed up manually, right now I'd be moving other projects forward instead of trying to remedy this version mismatch on an active production site.</p>
  
  <hr>
  
  <p><a href="https://i.sstatic.net/uwdcP.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/uwdcP.png" alt="DB structure img 1"></a>
  <a href="https://i.sstatic.net/EtCEf.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/EtCEf.png" alt="DB structure img 2"></a>
  <a href="https://i.sstatic.net/fF1tJ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/fF1tJ.png" alt="DB structure img 3"></a>
  <a href="https://i.sstatic.net/1DtLI.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/1DtLI.png" alt="DB structure img 4"></a>
  <a href="https://i.sstatic.net/BE0CV.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/BE0CV.png" alt="DB structure img 5"></a>
  <a href="https://i.sstatic.net/YoCJm.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/YoCJm.png" alt="DB structure img 6"></a>
  <a href="https://i.sstatic.net/SqN6X.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/SqN6X.png" alt="DB structure img 7"></a>
  <a href="https://i.sstatic.net/xIrxL.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/xIrxL.png" alt="DB structure img 8"></a></p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-09-09T05:59:33.517Z
Comments.Text: How did you update the database without changing the codebase to 5.6.alpha1? It is required to keep the codebase and the db version same for civi to run correctly.
Comments.UserDisplayName: jitendra - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-09-09T13:57:03.897Z
Comments.Text: Thanks for your question. I'm fairly new to git and command lines, so maybe I botched something when applying the 5.3.2 patch. After applying the patch and updating the DB, I was expecting Status to report the new version as 5.3.2, but it reported 5.6.alpha1 instead. And with no usable DB backup, I'm at a loss as to how best to proceed.
Comments.UserDisplayName: Prónay
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-09-09T15:35:42.667Z
Comments.Text: It appears that your database is at 5.6alpha1 so would it not be sensible to make the codebase the same? But first clear caches and erase the templates_c folder. That should get you to a stable and possibly usable position. From there you can determine your next step, which might be to stay with 5.6
Comments.UserDisplayName: Andy Clark
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-09-09T17:49:39.250Z
Comments.Text: Thanks Andy -- I was wondering about that, but turns out the solution was to change the Version value in the civicrm_domain table and clear the caches. Apparently the DB was already 5.4.1 (which matches the current codebase), but for reasons unknown had the wrong version identifier. When I tried to update the DB just now, I got the red-font-yellow background error message with the explanation "Your database has already been upgraded to CiviCRM 5.4.1" -- so grinning happily and heaving a sigh, I'm back on track now. :)
Comments.UserDisplayName: Prónay
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-09-10T17:10:24.530Z
Comments.Text: I'm so glad it's fixed - that was a horrible situation for you.
Comments.UserDisplayName: Andy Clark
Tags: <database><500><version>
Title: Database in unexpected version (and we have no backup DB)
ThreadText: # Database in unexpected version (and we have no backup DB)
  
  (Asked by: username_0 on 2018-09-09)
  
  Applied the 5.3.2 patch to our WP site yesterday, and in so doing upgraded the database to 5.6.alpha1. After doing this, multiple components (Contributions, Events, Mailing) became unusable. Trying to access these caused 500 (server) errors. Meanwhile, Civi 5.4.1 dropped, so I replaced the 5.3.2 patched code with 5.4.1 -- but couldn't update the database, because it was still 5.6.alpha1.
  "No problem," I thought -- I can restore the WP database from a backup. But the only backup I had was from after the 5.3.2 patch, i.e. in the 5.6.alpha1 state. And as luck would have it, the hosting provider's backup on the server was corrupt and couldn't be restored.
  So here's my dilemma. System Status tells me I need to "determine the correct version corresponding to your current database state." Should I try to manually alter the working database so it aligns with the 5.4.1 codebase (and if so, how do I even begin to do that)? Or do I try to reapply the 5.3.2 patch and hope to somehow fix the server errors? Or do I apply a different codebase entirely?
  The error message also suggests fixing the file civicrm-version.php -- so I set the 'version' value to '5.4.1' but no luck. I still get this: 
  Your database is marked with an unexpected version number: 5.6.alpha1. The v5.4.1 codebase may not be compatible with your database state. You will need to determine the correct version corresponding to your current database state. You may want to revert to the codebase you were using until you resolve this problem. OR if this is a manual install from git, you might want to fix civicrm-version.php file.
  
  How best do I fix this? And since Civi appears to be running okay right now despite having different codebase and database versions, is it possible the database version is somehow misidentified -- that the DB version is really 5.4.1, but identifies itself as 5.6.alpha1? Images (bottom) showthe current DB structure.
  As an aside, I've just learned a valuable lesson. Always store a DB backup locally before starting an upgrade, even when two automatic backup systems are running. If I had backed up manually, right now I'd be moving other projects forward instead of trying to remedy this version mismatch on an active production site.
  
  **Tags:** database, 500, version
  
  > **Comments:**
  > **username_1**: How did you update the database without changing the codebase to 5.6.alpha1? It is required to keep the codebase and the db version same for civi to run correctly.  
  > **username_0**: Thanks for your question. I'm fairly new to git and command lines, so maybe I botched something when applying the 5.3.2 patch. After applying the patch and updating the DB, I was expecting Status to report the new version as 5.3.2, but it reported 5.6.alpha1 instead. And with no usable DB backup, I'm at a loss as to how best to proceed.  
  > **username_2**: It appears that your database is at 5.6alpha1 so would it not be sensible to make the codebase the same? But first clear caches and erase the templates_c folder. That should get you to a stable and possibly usable position. From there you can determine your next step, which might be to stay with 5.6  
  > **username_0**: Thanks Andy -- I was wondering about that, but turns out the solution was to change the Version value in the civicrm_domain table and clear the caches. Apparently the DB was already 5.4.1 (which matches the current codebase), but for reasons unknown had the wrong version identifier. When I tried to update the DB just now, I got the red-font-yellow background error message with the explanation "Your database has already been upgraded to CiviCRM 5.4.1" -- so grinning happily and heaving a sigh, I'm back on track now. :)  
  > **username_2**: I'm so glad it's fixed - that was a horrible situation for you.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2018-09-09. Score: 1 | Accepted answer
  
  Ahh did you upgraded to unstable version of CiviCRM? The last stable release i see is 5.4.1. Try replacing the civicrm code base to 5.4.1 and then update the civicrm\_domain.version to 5.4.1 and also truncate all cache tables and anything under template\_c folder.
  
  > **Comments:**
  > **username_0**: That did the trick in short order! Already had installed the 5.4.1 codebase; it was the database that had me flummoxed. But after reading Pradeep's answer, I used phpMyAdmin to "SELECT * FROM `civicrm_domain`" and then "UPDATE `civicrm_domain` SET `version` = '5.4.1' WHERE `civicrm_domain`.`id` = 1;" ... then I used the Civi Admin (Administer / System Settings / Cleanup Caches and Update Paths) to finish up. Everything is good now, so THANK YOU! :)  
  
  ---
  
  