1

I have a database in SQL Server 2008 R2. I create a login in

SQL Object Explorer > Security > Logins > New > and ...

But, when I want login with aliadmin, I get an error :

Cannot connect to ..
Login failed for user 'aliadmin'. (Microsoft SQL Server , Error : 18456 , State 1)

Pictures of this error :

Cannot connect to ..
Login failed for user 'aliadmin'. (Microsoft SQL Server , Error : 18456 , State 1)

Additional Information ...

Please help me ... !

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
ALi GAZi
  • 15
  • 2
  • Did you set any rights to your created login? – Nicolas R Dec 31 '15 at 08:45
  • And is your server configured to use both Windows and SQL Server authentication? Check this SO question: http://stackoverflow.com/questions/1719399/sql-server-2008-cant-login-with-newly-created-user?rq=1 – Nicolas R Dec 31 '15 at 08:46
  • The **login** is only the first step - you've defined a name that can log in to this SQL Server instance. Now you need to create *one or several* **users** in the database this login should be allowed to use – marc_s Dec 31 '15 at 10:17

1 Answers1

2

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
Community
  • 1
  • 1
MAX
  • 1,562
  • 4
  • 17
  • 25