How to fix "An error has occurred. The target schema is in an unknown state" on Windows PC (VS Professional 2022)?


User's image

Hello there, i tried to compare and update schema few months ago. But i performed the wrong action. I set the source and target in the opposite way and updated. after that i also incorrectly performed a Post Deployment script which is not required. after that, i received this error message everytime i tried to compare and update the schema. I re-installed visual studio professional and SQL server management studio and re-clone the whole project, but however did not resolve this issue. Could anyone inform how i should resolve this issue please? Thanks!

Azure Database for MySQL
Azure Database for MySQL
An Azure managed MySQL database service for app development and deployment.
762 questions
{count} votes

1 answer

Sort by: Most helpful
  1. ShaktiSingh-MSFT 14,376 Reputation points Microsoft Employee

    Hi Lu, Yiling (SI BSW OPS TECH SW-ENG 3) •,

    Welcome to Microsoft Q&A forum.

    As I understand, you are getting "An error has occurred. The target schema is in an unknown state" in Azure Database for MySQL.

    Could you please try the solutions mentioned below:

    1). This could be caused by a new schema added, try to check drop and recreate.

    2). Check version of your Software, try updating if helps.

    3). Try to open VS with "Run As Administrator" mode.

    4). Try to clear cache file(dbmdl) from the project if that helps.

    Let us know if any of the above helps you proceed.

    If not, please share more details step wise so that we can investigate.