Error 18456 - sqlcmd - Unable to login to sql server after creating login, user

I am using sqlcmd to create a login and user and I still get unable to login.

These are my steps:
create login user1 with password = 'user1pw'
go
use newdb
create user user1 for login user1
go
sp_addrolemember 'db_datareader', 'user1'
go

sqlcmd user1
Password:  Password: Msg 18456, Level 14, State 1, Server MSSQLSVR, Line 1
Login failed for user 'user1'.
robjayAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
>sqlcmd user1
should it not be

sqlcmd -Uuser1 -Puser1pw
?

apart from that, do you have more than 1 instance?
possibly, you granted the permissions on a named instance, which sqlcmd will not try to connect to.

please clarify
0
 
robjayAuthor Commented:
I don't think I'm confusing another instance.  sqlcmd won't work with the sa also I'm unable to connect with SQL Server credential via the MSSMS.  This is a duplicated SQL Server from another one and all this is successful on that one, what should I check as the difference?
0
 
robjayAuthor Commented:
0

Experts Exchange Solution brought to you by ConnectWise

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.