Search code examples
sql-serversql-server-2014-express

Cannot create SQL Server Express Login - Login Failed for User


I have created a new login for SQL Server Express as follows:

USE [master]
GO
CREATE LOGIN [Test] WITH PASSWORD=N'SF#$%GD%^J675JFS4fds' 
    MUST_CHANGE, 
    DEFAULT_DATABASE=[master], 
    CHECK_EXPIRATION=ON, 
    CHECK_POLICY=ON
GO

ALTER SERVER ROLE [sysadmin] ADD MEMBER [Test]
GO

USE [master]
GO

CREATE USER [Test] FOR LOGIN [Test]
GO

USE [master]
GO

ALTER ROLE [db_securityadmin] ADD MEMBER [Test]
GO

When I try to connect via the Test login, I receive the error message that

Login failed for user 'Test'

Connect as new Test Login


Solution

  • I needed to configure the server for SQL Server and Windows Authentication Mode.

    1. Open SSMS.
    2. Connect to the server via Windows Authentication.
    3. Right click the server and choose Properties.
    4. Change to "SQL Server and Windows Authentication Mode"

    SQL Server and Windows Authentication Mode

    See also: http://www.microsoft.com/products/ee/transform.aspx?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=18456