Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

sqlcmd - SQL Server Network Interfaces: Connection string is not valid [87]

When I am running this from cmd on my SQL Server 2008 instance:

sqlcmd -U sa -S mymachinen_nameMSSQLSERVER

(where MSSQLSERVER is my instance name)

I get prompt for password and after that I get this:

Password:

HResult 0x57, Level 16, State 1 SQL Server Network Interfaces: Connection string is not valid [87].

Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : 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..

Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : Login timeout expired.

I have my SQL Server browser service started and also I can login through Management Studio with Windows authentication.

Also found this KB article, but this is for SQL Server 2005/2000.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Typically, the MSSQLSERVER service is the service of a un-named default instance.

Therefore, try this:

sqlcmd -U sa -S mymachine_name

(without specifying any instance name - just the machine name)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...