在 IIS 中使用 sql 服务器和 codeigniter 的数据库连接错误

Database Connection error using sql server and codeigniter in IIS

通过PHP连接MSSQL数据库时出错 我无法连接到远程系统中的 sql 服务器数据库。它显示无法使用提供的设置连接到您的数据库服务器。 文件名:

returns 波纹管错误..

Array ( [0] => Array ( [0] => 28000 [SQLSTATE] => 28000 [1] => 18456 [code] => 18456 [2] => [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Login failed for user 'NT AUTHORITY\IUSR'. [message] => [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Login failed for user 'NT AUTHORITY\IUSR'. ) [1] => Array ( [0] => 42000 [SQLSTATE] => 42000 [1] => 4060 [code] => 4060 [2] => [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Cannot open database "pestcontrol" requested by the login. The login failed. [message] => [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Cannot open database "pestcontrol" requested by the login. The login failed. ) )

这可以解决您的问题

$db['default']['username'] = 'root';
$db['default']['password'] = '';

xampp、lampp 和 wampp 默认设置。如果您想创建自己的凭据,可以在给定的代码中编写它。

或者试试这个 link:

https://www.c-sharpcorner.com/UploadFile/specialhost/how-to-fix-login-failed-for-user-nt-authority-iusrs-in-share/