Question about user and login

  • Hello

    I created new login and new user to exists login. Next step is log to database with created username database and login password??

    Regards

  • What sort of login did you create?

    If you gave a windows login access to SQL Server, and have created a user for it in its default database, then you connect to SQL Server using the windows login (so you have to be logged in to windows with that login, and SQL Server won't ask you for the password).

    If you made a SQL Server login which isn't a windows login, and created a user for it in its default database, you need to create a password for that SQL Server login. Once you've done that, you can login with that login and password.

    You can never login using a username, because usernames are internal to SQL Server, you have to log in to SQL Server using a login.

    Tom

  • bonifacy (7/29/2013)


    Hello

    I created new login and new user to exists login. Next step is log to database with created username database and login password??

    Regards

    I don't really understand your question here? Please explain.

    SueTons.

    Regards,
    SQLisAwe5oMe.

  • Question is not clear.

    Please explain what you want to try?

  • Ok, sorry for my english.

    I created new user by syntax: ( create user TestUser for login TestLogin ) How I can use this user in SQL Server Authentication?

    I greet

  • When you created the login TestUser, did you specify SQL Server Authentication or Windows Authentication?

  • bonifacy (7/31/2013)


    Ok, sorry for my english.

    I created new user by syntax: ( create user TestUser for login TestLogin ) How I can use this user in SQL Server Authentication?

    If I understand the question correctly, the answer is that you don't. When you log in, you need to use the login name, TestLogin. TestUser is just the name for the login in the database and that name only means something in the database.

    Normally, the name of the database user and the server login are the same. Rarely, there is any reason to use different names. (The one exception is when a login maps to dbo.)

    [font="Times New Roman"]Erland Sommarskog, SQL Server MVP, www.sommarskog.se[/font]

  • Erland Sommarskog (7/31/2013)


    Normally, the name of the database user and the server login are the same. Rarely, there is any reason to use different names. (The one exception is when a login maps to dbo.)

    I think that might depend on your auditing policy. Several logins might have the same capabilities, so map to the same usernames (using usernames to represent capability sets); in that case, knowing who does what depends on the login name, and you don't want to give the same login name to different people. It's even worse if it's a window login name and the people, although their logins map to the same database user name and they have identical capabilities within SQL Server, have different capabilities in the broader windows context.

    Tom

  • L' Eomot Inversé (2013-07-31)


    I think that might depend on your auditing policy. Several logins might have the same capabilities, so map to the same usernames (using usernames to represent capability sets)

    Not sure that I follow. A row in sys.database_principals can only map to one row in sys.server_principals, so you cannot map the database user Nisse to the logins Kalle and Putte. Nor can you create two users for the same login in a database.

    When you add Windows groups to the mix the story becomes a little different, so far that you can grant permissions to the Windows group and add the group as a database user. But the login name and the user name in the database is the same in this case.

    [font="Times New Roman"]Erland Sommarskog, SQL Server MVP, www.sommarskog.se[/font]

  • Erland Sommarskog (8/1/2013)


    L' Eomot Inversé (2013-07-31)


    I think that might depend on your auditing policy. Several logins might have the same capabilities, so map to the same usernames (using usernames to represent capability sets)

    Not sure that I follow. A row in sys.database_principals can only map to one row in sys.server_principals, so you cannot map the database user Nisse to the logins Kalle and Putte. Nor can you create two users for the same login in a database.

    When you add Windows groups to the mix the story becomes a little different, so far that you can grant permissions to the Windows group and add the group as a database user. But the login name and the user name in the database is the same in this case.

    You are right. My comment was nonsense - maybe a sign of the onset of senility!

    Tom

  • Thanks.

    I greet 🙂

Viewing 11 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic. Login to reply