The issue is now fixed.
I deleted and re-created MSSQLLocalDB using the steps given in the following link:
c# - Logon failed for login due to trigger execution - Stack Overflow
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:\Users\tom.jefferson> sqllocaldb info
MSSQLLocalDB
ProjectModels
PS C:\Users\tom.jefferson> sqllocaldb delete "MSSQLLocalDB"
LocalDB instance "MSSQLLocalDB" deleted.
PS C:\Users\tom.jefferson> sqllocaldb create "MSSQLLocalDB"
LocalDB instance "MSSQLLocalDB" created with version 15.0.4153.1.
PS C:\Users\tom.jefferson> sqllocaldb info "MSSQLLocalDB"
Name: MSSQLLocalDB
Version: 15.0.4153.1
Shared name:
Owner: MKS\tom.jefferson
Auto-create: Yes
State: Stopped
Last start time: 7/12/2023 11:48:02 AM
Instance pipe name:
PS C:\Users\tom.jefferson>
Microsoft Windows [Version 10.0.19044.2965]
(c) Microsoft Corporation. All rights reserved.
- // This command has worked in the past and is now working again
C:\Users\tom.jefferson>sqlcmd -S "(localdb)\MSSQLLocalDB"
1> select name from sys.databases
2> go
name
master
tempdb
model
msdb
(4 rows affected)
1> exit
- // These commands specified in the documentation referenced by the link in your answer still all fail with the same error as before (even though my issue is fixed now)
C:\Users\tom.jefferson>sqlcmd -S "admin:(localdb)\MSSQLLocalDB"
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : SQL Server Network Interfaces: An error occurred while obtaining the dedicated administrator connection (DAC) port. Make sure that SQL Browser is running, or check the error log for the port number [xFFFFFFFF]. .
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..
C:\Users\tom.jefferson>sqlcmd -A
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : SQL Server Network Interfaces: An error occurred while obtaining the dedicated administrator connection (DAC) port. Make sure that SQL Browser is running, or check the error log for the port number [xFFFFFFFF]. .
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..
C:\Users\tom.jefferson>sqlcmd -A -d master
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : SQL Server Network Interfaces: An error occurred while obtaining the dedicated administrator connection (DAC) port. Make sure that SQL Browser is running, or check the error log for the port number [xFFFFFFFF]. .
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..