It seems that you have installed a logon trigger that does not work as intended.
You can get out of the situation this way. First stop the instance:
sqllocaldb stop MSSQLLOCALDB
Then start Regedit and go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL15E.LOCALDB\MSSQLServer\Parameters
. In the right pane, right-click and select New->String value. The name should be SQLArg0
. For the value enter -f
. This option says that you want to start SQL Server with minimal configuration.
Now start the instance:
sqllocaldb start MSSQLLOCALDB
Connection should work at this point. Note that you may still see a message box saying that the connection failed. This due to that SSMS makes two connections. One for the query window, and one for intellisense. Since -f
puts the server into single-user mode, the intellisense connection fails.
Once in a query window, find the name of the logon trigger by running
SELECT * FROM sys.server_triggers
Drop the offending trigger with
DROP TRIGGER <triggername> ON ALL SERVER
Or if you to retain the trigger to correct it:
DISABLE TRIGGER <triggername> ON ALL SERVER
Once you have completed this, stop the localdb instance again, and delete SQLArg0 from the registry and then start LocalDB again.