【摘要】Failed to generate a user instance of SQL Server due to ...

Error: SQL Express 2008 ERROR: Failed to generate a user instance of SQL Server and
Error: Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed."

To correct the problem, I

  1. Shut down SQL Server Express
  2. Deleted the users SQL Express directory "%USERPROFILE%\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS"
  3. Restarted SQL Server Express:

Here's a cmd script for what is needed:

SC.EXE stop "MSSQL$SQLEXPRESS"
CHOICE /C:N /D:N /N /T:5
RD /S /Q "%USERPROFILE%\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS"
SC.EXE start "MSSQL$SQLEXPRESS"

原文地址:https://www.cnblogs.com/ShineTan/p/1869014.html