3

I just finished installing SQL Server 2016 (The full thing -- not just Express). I specified Windows authentication. During the install in the install wizard, in the Database Engine Configuration node and on the Server Configuration tab, I simply clicked the Add Current User button. I didn't add a specific user for administration at install time.

Before posting, I also took a look at this: https://msdn.microsoft.com/en-us/library/ms180944.aspx

Anyway, when I run this from a command prompt:

C:\Users\dogzilla>sqlcmd -S dogzilla -U dogzilla

I get this error:

Password: Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Login failed for user 'dogzilla'..

dogzilla is the account I use to log into Windows with. I know the password since I'm able to write this to you.

What's going on with the authentication? Does the dogzilla password need to be set in SQL Server? How can I change it there?

Thanks!

1
  • The -U option for SQL Authentication is BTW not 2016 specific. It is quite old. In the past however SQL-Authentication was turned off by default. Do not specify it and it should work. All users in the local Windows Administrators group are also DBA.
    – eckes
    Feb 18 '17 at 22:37
3

If you're connecting to a local instance with Windows authentication you specify -E (or nothing, it's the default). Specifying -U will attempt to login with a SQL login.

Here's an example where I connect to a local named instance using Windows auth and run a simple command.

ULTRAVOX!

5
  • Thanks for the answer... it didn't work though. My hostname is dogzilla and the instance is MSSQLSERVER. When I run: codeC:\Users\dogzilla>sqlcmd -S dogzilla\MSSQLSERVER -E
    – MGoBlue93
    Feb 20 '17 at 2:43
  • It errors out with this: codeSqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : SQL Server Network Interfaces: Connection string is not valid [87]. codeSqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Login timeout expired. codeSqlcmd: Error: Microsoft ODBC Driver 13 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..
    – MGoBlue93
    Feb 20 '17 at 2:49
  • Yeah. That's because you don't have a named instance. You're using the default instance name. You're misunderstanding my instructions, and I think you should ask the question in a language you're more comfortable with. I don't think I can help you in English. Feb 20 '17 at 3:12
  • @MGoBlue93 It makes sense to think you can connect using the "default instance name", but no, you have to remove it. This should work for you: sqlcmd -S dogzilla -E
    – T.H.
    Feb 21 '17 at 12:28
  • Thanks @TH. sp_BlitzErik... no need for the snark. I speak and write English quite well. The Microsoft link I provided does not mention a default instance name isn't specified. It specifically states to use the MMC to find the instance name(s) and then use the name(s) found when using the command line.
    – MGoBlue93
    Mar 2 '17 at 20:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.