Login creation failed

  • Hello Master,

    My client created a local non domain windows account and now they want me to add that acount on SQL Server and want sysadmin rights. My SQL Server is in domain on that machine. While creating user, I am able to search that account (As it is local machine account) but I am not able to create login for the same. I got an error :

    "Error 15401: Windows NT user or group '%s' not found".

    Is it necessary that new login should be in domain ? OR how can I create login for Nondomain(local account) account ?

  • Yeah..!! 🙂 I did it.

    I was trying to create user with "Windows authentication" as it was local user, I was getting error. I tried with "SQL Server Authentiacation" and it works..!!

    Huh, I did it. 🙂

  • The SQL login you created isn't associated with the local Windows account. You've created a stand-alone login within SQL, which is why it asked you to create a new password instead of using the password of your Windows user. Here is a script that will create the login, and then add it to the 'sysadmin' server role.

    USE [master]

    GO

    CREATE LOGIN [MyDBServer\LocalAccount] FROM WINDOWS WITH DEFAULT_DATABASE=[master]

    GO

    EXEC sp_addsrvrolemember 'MyDBServer\LocalAccount', 'sysadmin'

    GO

Viewing 3 posts - 1 through 2 (of 2 total)

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