2

我正在尝试连接到我的 sql server 数据库,但我不断收到此消息:

    Array ( [0] => Array ( [0] => 28000 [SQLSTATE] => 28000 [1] => 18456 
[code] => 18456 [2] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'NT AUTHORITY\SYSTEM'. [message] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'NT AUTHORITY\SYSTEM'. ) 
[1] => Array ( [0] => 42000 [SQLSTATE] => 42000 [1] => 4060 
[code] => 4060[2] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Cannot open database "Store" requested by the login. The login failed. 
[message] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Cannot open database "Store" requested by the login. The login failed. )
 [2] => Array ( [0] => 28000 [SQLSTATE] => 28000 [1] => 18456 [code] => 18456 [2] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'NT AUTHORITY\SYSTEM'. 
[message] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'NT AUTHORITY\SYSTEM'. ) 
[3] => Array ( [0] => 42000 [SQLSTATE] => 42000 [1] => 4060 
[code] => 4060 [2] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Cannot open database "Store" requested by the login. The login failed.
 [message] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Cannot open database "Store" requested by the login. The login failed. ) )

我什至不明白那个 NT AUTHORITY\SYSTEM 用户是什么。它在 Apache 上运行。

UPD:忘记添加代码

<?php
$servername="(local)";
$connection=array("Database"=>"Store");
$link = sqlsrv_connect($servername,$connection);
if( $link )
{
     echo "Connection established.\n";
}
else
{
     echo "Connection could not be established.\n";
 die( print_r( sqlsrv_errors(), true));
}
?>

UPD2:问题已解决。一如既往,我试图使用一些帮助。感谢您解释 NT Authority\System 用户是什么。将运行 apache 的用户更改为用于 sqlserver 的用户,并且可以正常工作。

4

1 回答 1

0

看看这是否解决:http ://security.fnal.gov/cookbook/LocalSystem.html

检查数据库存储是否也存在!

祝你好运 !

于 2013-05-27T19:38:45.587 回答