Wednesday, March 28, 2012

How to create new user?

Hi,

i'm using SQL server 2005 and I need to create new login/user. Previously I used MySQL where user management is much simplier, so I need a help with SQL server. I run following script:

EXEC sp_addlogin 'uzivatele', @.passwd = 'xyz', @.defdb = 'master', @.deflanguage = 'Czech'
GO

EXEC sp_addsrvrolemember 'uzivatele', 'sysadmin'
GO


GRANT CONNECT SQL TO [uzivatele]
GO

CREATE USER [jirka]
FOR LOGIN [uzivatele]
GO

But when I try to connect o database "master" as user "jirka" with password "xyz", it fails with message "Login failed for user 'jirka'". What do I wrong?

thanks

Jiri Matejka

Hi Jiri,

You need to login as "uzivatele" with password of "xyz" - this will then map the login to the user "jirka" on the master database.

Cheers,
Rob

No comments:

Post a Comment