user login problem

john doe 1 Reputation point
2021-09-07T13:32:06.657+00:00

dear admins
I create a new user login for a database with this option:
General:
{
login name : abcd
password:1234
default database: master
}
Server role : public
User Mapping:
{
Database: advantureWork
role memberShip: public
}
then OK;
this user added to two databases;
I checked again and again, I'm sure that I select one database in user mapping option;
i don't what happend! do you know?

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,696 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Olaf Helper 40,741 Reputation points
    2021-09-07T13:47:23.843+00:00

    this user added to two databases;

    Guess into the blue: An orphaned database user with same user name, but different SID. Can you access the database using the login?

    https://learn.microsoft.com/en-us/sql/sql-server/failover-clusters/troubleshoot-orphaned-users-sql-server?view=sql-server-ver15

    0 comments No comments

  2. YufeiShao-msft 7,056 Reputation points
    2021-09-08T02:43:19.553+00:00

    Hi @john doe ,

    Just like Olaf said, whether you can access both two databases using this login?
    Or you can just use T-SQL to create a login user

    USE [master]  
    GO  
    CREATE LOGIN [abcd] WITH PASSWORD=N'1234', DEFAULT_DATABASE=[master], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF  
    GO  
    USE [advantureWork]  
    GO  
    create USER [abcd] FOR LOGIN [abcd]  
    GO  
    
    0 comments No comments