SQL Server Windows authentication error - sql-server

I am using SQL Server 2016 on Windows Server 2012.
Also I am using SQL Server in a workgroup.
What I did is
installed AD DC (SQL server was installed before i install AD DC)
Removed AD DC to go back to workgroup and get local administrator user
After I did this, I cannot login to SQL Server using Windows Auth anymore
When I try to login with Windows authentication, I got this error
Login failed for user 'domain\username'. (Microsoft SQL Server, Error: 18456)
and I checked error log for the error state, the error state was 5.
But when I connect using sa user and checked login folder in Security folder, I see the correct user with the same name as my local user name. See the screenshot below
My local admin username is WIN-2NEKEGJF11Q\Administrator
Please, help me
-see the red line

Related

Error connecting to SQL Server with Windows Authentication

I want to connect to SQL Server with Windows authentication and create a SQL Server user.
The error I get while doing this is:
Login failed for user 'PCNAME\UserName'. Reason: The account is disabled. (Microsoft SQL Server, Error: 18470)
I also get the following error when I try to connect with PsTools:
Unable to connect: Login failed for user 'NT AUTHORITY\SYSTEM'.
Reason: The account is disabled.
What kind of process should I provide to activate the NT AUTHORITY\SYSTEM user? Or how can I act?
Thank you in advance for your help.
Well, you are trying to connect while logged on as pcname\username. If this user is not created as a Windows user in SQL Server or is disabled in SQL Server, then you will not be able to connect. What you need to do is use an authorized account to created the windows authenticated user in pcname\username in SQL Server then you will be able to connect.
As for pcname\SYSTEM, this is a built in SID that is used by services. There is no reason you could not add this as a Windows authenticated user in SQL Server.

Cannot Login in SQL Server Management Studio, Error: 233

I changed authentication mode from "Windows Authentication" to "Windows Authentication and SQL Server Authentication" and also enabled "sa" user and changed it's password and defined another user.
But now when I want to login in SQL Server Management Studio, it will show me this error:
I restarted SQL services
I restarted windows
I changed authentication mode from windows registry (because I couldn't login and change it in Properties)
You should login with windows auth. again and you should change sa user permission in roles as system admin. at the end of this process you should restart again sql service in services.
You can't login because you have a bad setting of your sa user, so for fix this problem you have to do this
So you can login now. Then enter to properties of the server in the security page check windows authentication y also verify connection page and set to the default

New User in SSMS Can't Login

I have installed SSMS (v17.1), created a new login at Security -> Logins, changed mode on the server (server: OWNER) to mixed mode. But the username/password combination doesn't seem to work. New Database Query -> SQL Server Authentication -> enter username/password and get error: Cannot connect to OWNER. Login failed for user 'myusername'. HELP!
According to Change Server Authentication Mode when the authentication mode is changed the server has to be restarted. Until restart SQL Server is still using Windows only authentication mode and that is what we can read is SQL Server error log as the reason of 18456 "login failed for user (...)"
I got this to work by following the instructions here: https://serverfault.com/questions/422269/where-can-i-find-the-user-in-this-iis-error-login-failed-for-user-iis-appool-w
All I did was create a user on the database, named IIS APPPOOL\DefaultAppPool, and a login, also named IIS APPPOOL\DefaultAppPool, using Windows authentication, and pointed the user at the login and it worked. Frankly, I'm still not sure why my custom SQL Server user didn't work, but at least I can move forward with my project.

Error 18456 loggin on a SQL Server 2016

I had an unexpected system crash and had to setup SQL Server 2016 again. I can connect to the server from SSMS if I use a Windows authentication account, but not via any login created. I keep getting an error 18456:
Login failed for user 'sa'
Steps:
I have enabled SA login and gave it a password but cannot connect via SSMS
I have created another login and matched it to my project database, the project database now has the login under its users but again, I cannot log in.
SSMS is installed on the actual db server so I doubt this is a remote login issue, but as the db server is isolated from the actual site I would like to update this if needed.
Any ideas would greatly be appreciated!
Did you enable the mixed mode authentication?
Did you restart SQL services after changing the mixed mode authentication?
Some of the server level properties takes only after a SQL restart , one such is authentication modes.
Usually a SQL Service problem.
Start - > View Local Services -> SQL Server(SQLEXPRESS) > restart it

Windows Authentication not working with SQL Server

I am trying to set up an SQL Server Login and User using Windows Authentication.
What I have done so far is as follows:
Added a new non-administrator account to my PC called "User1". The PC is called "DESKTOP" so the full username is "DESKTOP\User1"
Created an SQL Server login for this user using the "FROM WINDOWS" option to link the SQL Login to my PC login. The user is called e.g. "DESKTOP\User1."
Created a database level user for the SQL Server login using the "FOR LOGIN" option to link the user to the SQL Server login.
Verified that the new database user is not a member of the "SysAdmins" group and that the login is enabled and login access is allowed.
Logged out of my administrator Windows account and logged in as "User1". I successfully logged in.
Started SSMS, ensured the username set was "DESKTOP\User1" and that "Windows Authentication" was selected.
When I pressed "Connect" I was presented with an error which in the event log reads as follows:
Token based server access validation failed with an infrastructure error
Server Name: DESKTOP
Error Number: 18456
Severity: 14
State: 1
Line Number: 65536
Reading about this, there is a suggestion that this is a UAC error. So I ran SSMS as an administrator. On Windows 8.1 it then asks me to log in with the system adminstrators account - which works - but then I am logged into SQL Server as "DESKTOP\Administrator" and not "DESKTOP\User1".
Why can't Windows pass my non-administrator credentials to SQL Server and log me in? The point of this is so that (in the future "domain") users can access the SQL Server with non-administrator privileges and using Windows Authentication.
Thanks in advance.
The problem was that the BUILTIN\Users group had its login permission disabled.
This must override the individual user accounts. DESKTOP\User1 must be part of this group, and the group level permission overrode it.
I am assuming you have the following message in your SQL Server event log:
Login failed for users ‘DESKTOP\User1’. Reason: Token-based server access validation failed with an infrastructure error. Check for previous errors. [CLIENT: xxx.xxx.xxx.xxx]
Error: 18456, Severity: 14, State: 12
State 12 means that SQL Server was able to authenticate you, but weren’t able to validate with the underlying Windows permissions.
Try logging into the server as the admin and running the following:
GRANT CONNECT SQL TO [DESKTOP\User1];
GRANT CONNECT ON ENDPOINT::"TSQL Default TCP" TO [DESKTOP\User1];

Resources