繁体   English   中英

将php连接到MS SQL Server。 登录失败

[英]Connecting php to MS SQL Server. Login failed

我正在尝试连接到我的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的用户,并且可以正常工作。

查看是否可以解决: http : //security.fnal.gov/cookbook/LocalSystem.html

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

祝好运 !

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM