Connection Failed - Array 28000.
Applies to: SQL Server 2014 Express Edition.
Problem Description.
One of my students was trying to connect to a SQL Server instance from a PHP
program but received the following error messages on PHP:
Connection Failed. Array ( [0] => Array ( [0] => 28000 [SQLSTATE] => 28000 [1]
=> 18456 [code] => 18456 [2] => [Microsoft][ODBC Driver 11 for SQL Server][SQL
Server]Login failed for user 'Zekker'. [message] => [Microsoft][ODBC Driver 11
for SQL Server][SQL Server]Login failed for user 'Zekker'. ) [1] => Array ( [0]
=> 28000 [SQLSTATE] => 28000 [1] => 18456 [code] => 18456 [2] => [Microsoft][ODBC
Driver 11 for SQL Server][SQL Server]Login failed for user 'Zekker'. [message]
=> [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Login failed for user 'Zekker'.
) )
When I opened the SQL Server Error Log on that instance I found the following
error lines:
Date 11/9/15 8:23:55 p. m.
Log SQL Server (Current - 11/9/15 8:20:00 p. m.)
Source Logon
Message
Login failed for user 'Zekker'. Reason: An attempt to login using SQL
authentication failed. Server is configured for Windows authentication only.
[CLIENT: 10.0.2.15]
Cause.
The login created by my student was a SQL Server login but the SQL Server
instance was configured to not allow SQL authentication and allow Windows
authentication only.
Solution.
To change the authentication mode and allow both Windows and SQL
authentications, please try the following procedure:
1.Open SQL Server Management Studio, on Object Explorer, make a right-click
on the server name, and then click Properties.
2.On the left panel click on the Security page, under Server authentication,
select "SQL Server and Windows Authentication mode", and then click OK. For
reference, see the image below.
3.In the SQL Server Management Studio dialog box, click OK to acknowledge the
requirement to restart SQL Server.
4.In Object Explorer, right-click your server, and then click Restart.
References.
Change Server Authentication Mode.