ChatGPT解决这个技术问题 Extra ChatGPT

SQL Server 2008 can't login with newly created user

I'm using using Windows Vista and I'm having trouble logging in with a newly created user.

I open SQL Server Management Studio. I create a new Login by right-clicking on Security->Logins. Check: SQL Server Authentication Login name: tester Password: test Click OK I added this user to User Mapping to my database of choice. Click File -> Connect Object Explorer, select SQL Server Authentication and enter tester/test and click Connect.

I get an error:

Login failed for user 'tester'. (Microsoft SQL Server, Error: 18456" 
with Severity = 14 and State = 1.

What causes this error and how do I login with my user?


B
Bobrovsky

SQL Server was not configured to allow mixed authentication.

Here are steps to fix:

Right-click on SQL Server instance at root of Object Explorer, click on Properties Select Security from the left pane. Select the SQL Server and Windows Authentication mode radio button, and click OK. Right-click on the SQL Server instance, select Restart (alternatively, open up Services and restart the SQL Server service).

This is also incredibly helpful for IBM Connections users, my wizards were not able to connect until I fxed this setting.


I think it's good because it lets potential responders know that the problem is resolved. It also contributes to a growing body of documentation that other developers can use to find their own answers in the future.
It is definitely not bad to answer your own questions. Even years after data your answer was useful for me!
I had the same problem. Was looking for a solution for hours. Tried everything i could to solve it but didn't happen. Then i saw this post. I thought restarting the service is something that i haven't tried. So i restarted the service and it worked! Then i logged in only to say ... THANK YOU
The blame should be on the ridiculous error message. Had it said something like "Could not login. SQL Server Authentication is not allowed. The server is configured to allow Windows Authentication only. Please contact ..." it would have saved a lot of pain.
@Tony Interesting. Thanks. Still, i am not convinced that security as valid excuse to hamper usability. There could have been something in the message to point the user to the problem resolution.
E
Eric Leschinski

If you haven't restarted your SQL database Server after you make login changes, then make sure you do that. Start->Programs->Microsoft SQL Server -> Configuration tools -> SQL Server configuration manager -> Restart Server.

It looks like you only added the user to the server. You need to add them to the database too. Either open the database/Security/User/Add New User or open the server/Security/Logins/Properties/User Mapping.


Thanks for noticing.. I forgot to mention that I edited User Mapping to do this.
Old thread I know, but I had to add a new Login to the server before I could add a new User to the Database. Server > Security > Logins > Right click, New Login Server > Databases > Select Database > Security > Users > Right Click, New User.
G
GuyBehindtheGuy

You'll likely need to check the SQL Server error logs to determine the actual state (it's not reported to the client for security reasons.) See here for details.


Thanks.. I've already been to that page. Notice it doesn't mention what State = 1 actually means. Grr... but I'm all good now.
As the page explains, the State logged in your SQL Server error log will be different than the state that's reported to the user.
C
Community

Login to Server as Admin

Go To Security > Logins > New Login

Step 1:

Login Name : SomeName

Step 2:

Select  SQL Server / Windows Authentication.

More Info on, what is the differences between sql server authentication and windows authentication..?

Choose Default DB and Language of your choice

Click OK

Try to connect with the New User Credentials, It will prompt you to change the password. Change and login

OR

Try with query :

USE [master] -- Default DB
GO

CREATE LOGIN [Username] WITH PASSWORD=N'123456', DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=ON, CHECK_POLICY=ON
GO

--123456 is the Password And Username is Login User 
ALTER LOGIN [Username] enable -- Enable or to Disable User
GO