1. Manually Remove Any Corrupt LocalDB Files
A. Stop Any Running SQL Services
Run the following command in PowerShell (Admin):
Stop-Service "MSSQL$MICROSOFT##SSEE" -Force -ErrorAction SilentlyContinue
Stop-Service "MSSQL$SQLEXPRESS" -Force -ErrorAction SilentlyContinue
Stop-Service "MSSQL$MSSQLSERVER" -Force -ErrorAction SilentlyContinue
Then, check for running instances:
Get-Service | Where-Object {$_.DisplayName -like "SQL" }
If you see any running SQL Server-related services, manually stop them from Task Manager > Services.
B. Delete SQL LocalDB Files Manually
- Open File Explorer and go to:
2. C:\Users\dcadmin\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\
- Delete the entire MSSQLLocalDB folder.
- Navigate to:
5. C:\Program Files\Microsoft SQL Server\
and delete any folders related to LocalDB.
2. Remove LocalDB from Registry
Since LocalDB is not functioning properly, we need to clean the registry:
- Open Registry Editor (regedit.exe).
- Navigate to:
3. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server Local DB\Instances\
- Delete the MSSQLLocalDB key.
- Navigate to:
6. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\
and delete any references to LocalDB.
3. Reinstall LocalDB
A. Uninstall LocalDB Completely
- Open Control Panel > Programs & Features.
- Uninstall:
- Microsoft SQL Server LocalDB
- Microsoft SQL Server 2019 Express LocalDB (or any other version)
- Microsoft SQL Server Compact Edition (if installed)
- Microsoft SQL Server 2019 Express LocalDB (or any other version)
- Microsoft SQL Server LocalDB
B. Download and Reinstall LocalDB
- Go to Microsoft's website: Download SQL Server Express LocalDB
- Download the SQL Server Express LocalDB installer.
- Install it using the default settings.
4. Recreate and Start LocalDB
After reinstalling, run:
sqllocaldb create MSSQLLocalDB
sqllocaldb start MSSQLLocalDB
sqllocaldb info
You should now see the instance properly created and running.
5. Retry Installing Entra Connect
Once LocalDB is working, retry installing Microsoft Entra Connect.