New User in SSMS Can't Login - sql-server

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.

Related

Change database authentication mode

I have a SQL Server Express database on my desktop that I use to test an old classic asp program. I need to change the authentication method from Windows authentication to password authentication. I have changed the server from windows auth to SQL Server and Windows auth mode and restarted the server. I went into security and added a new login for the database set the name and login and the default db to the db I need to be able to use password to login to. When I attempt to log in using SQL Authentication I get the error message
CANNOT OPEN USER DEFAULT DATABASE. LOGIN FAILED. LOGIN FAILED FOR USER ERROR 4064
I open the connection properties and changed the connect to db to the db for the password login and got the same message. I have searched the internet and tried ever solution I could find to no avail. What am doing wrong?
First of all see if the sql server was configured to received SQL Server Autentication (Mix Mode)
right clink at server at the management-> porperties -> security
choose the option below and restar the service
other commum problem to some connection it that the user was create with a wrong default database
open the security folder at the management-> Logins
Choose your the login and open the properties like this below
Tell me if it's works

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

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

Unable to log in to server in SQL Server 2008 R2 Management Studio

I have a SQL Server 2008 R2 instance and can log in using the sa user. But I want to define another user (administrator) to log in with SQL Server Management Studio, so I did the following:
Logged in to the server in Management Studio as sa.
Right clicked on the database name.
Clicked on properties.
Then under permission, I select the required username (administrator).
And I grant him all the permission.
But when I tried to log in using administrator, I got the following error:
Login failed for user “administator” Error 18456.
Can anyone advise what might be the problem?
If the server encounters an error that prevents a login from succeeding, the client will display the following error mesage.
Msg 18456, Level 14, State 1, Server <server name>, Line 1
Login failed for user '<user name>'
This usually means that your connection request was successfully received by the server name you specified but the server is not able to grant you access for a number of reasons and throws error: 18456.
This eventID sometimes provides also state 1 which actually isn’t that useful as due to security reasons any error is converted to state 1 unless you can check logging on the server.
Microsoft does not provide very useful message boxes so below are some explanations why you get the error.
Invalid userID: SQL Server is not able to find the specified UserID on the server you are trying to get. The most common cause is that this userID hasn’t been granted access on the server but this could be also a simple typo or you accidentally are trying to connect to different server (Typical if you use more than one server)
Invalid password: Wrong password or just a typo. Remember that this username can have different passwords on different servers.
less common errors: The userID might be disabled on the server. Windows login was provided for SQL Authentication (change to Windows Authentication. If you use SSMS you might have to run as different user to use this option). Password might have expired and probably several other reasons….
18456 state 1 explanations: Usually Microsoft SQL Server will give you error state 1 which actually does not mean anything apart from that you have 18456 error. State 1 is used to hide actual state in order to protect the system, which to me makes sense. Below is a list with all different states and for more information about retrieving accurate states visit Understanding "login failed" (Error 18456) error messages in SQL Server 2005
SQL Authentication not enabled: If you use SQL Login for the first time on SQL Server instance than very often error 18456 occurs because Windows Authentication (only) is set in Server properties (security section).
To Access Server Properties,
- Open SQL Server Management Studio, go to Object Explorer pane (use view if you can’t see it).
- Use the connect button to connect to database engine for your server. Once connected you will see it in object explorer.
- Right click server and click properties. Server Properties window will appear.
See below screenshot that might be causing SQL login to fail
You should set Server Authentication to SQL Server Windows Authentication
To resolve this error follow the steps below on computer with SQL Server 2005.
Create new user with Administrator privilege with same username and password as of SQL Server 2008 in operating system.
On SQL Server database create new user by expanding DatabaseNode >> Security >> Login >> - Create New User and add this new user with Windows Authentication radio button selected. - This user can be only added by selected Windows Authentication it is Operating system’s User Login.
Once above two steps are completed when connected from SQL Server 2008 to SQL Server 2005 using Windows Authentication it will connect successfully.
How to fix? Check this link video SQL Server and Windows Authentication Mode page.
Source
You need to add a server login:
Connect to your SQL Server with SSMS as sa.
Drill into the server's Security folder in SSMS's Object Explorer pane.
Right-click on the server's Security > Logins folder that appears in Object Explorer.
Click on New Login... in the context menu that appears.
Provide details of the new login in the Login - New dialog that opens - particularly its General, Server Roles, and User Mappings pages (along the left). (See the screenshots of each page with sample input at the bottom of the answer.)
You may need to add a database user depending on your needs, but a server login (like your sa login) is necessary to connect to the SQL Server instance using Windows or SQL Server authentication. Mapping the new login to a database user (in the Login - New dialog's User Mappings page) will create a new user in the mapped database if you specify a username that does not already exist; alternatively you can map the new login to an existing database user.
Another SO question speaks to the differences between server logins and database users.
Login - New (General page)
SQL Server authentication
or
Windows authentication
Login - New (Server Roles page)
Login - New (User Mappings page)
SQL Server authentication
or
Windows authentication

SQL server - Login failed for user ''.

Not sure if this should go on this forum or on IIS forum...
I have an IIS 7.5 web site on a 2008 R2 box with the application pool configured to run under a local user called ProcessIIS.
This web site then connects to a sql database on the same box under windows authentication.
However every time it tries to make the connection it fails at the sql side with an error -Login failed for user ''. Reason: An attempt to login using SQL authentication failed. Server is configured for Windows authentication only. [CLIENT: ]
If I change the application pool identity to IUSR then the correct name is picked up ( although the login fails this time due to rights).
I have already configured a test box the exact same way and no issue was found - any ideas ?
Ok - solved this - not exactly sure what was wrong. But after deleting the user completely, removing the server from the domain. Readding the server back to the domain, recreating the user and finally adding the user back into SQL & IIS all works correctly ???

Resources