Search code examples
phpsql-servercodeigniteriisdatabase-permissions

Database Connection error using sql server and codeigniter in IIS


Error to connect MSSQL database through PHP I can't able to connect to sql server database in remote system. It is showing Unable to connect to your database server using the provided settings. Filename:

returns the bellow error..

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. ) )


Solution

  • This can be solve your problem

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

    It is by default setting in xampp, lampp and wampp. If you want create your own credential you can write it in the code given.

    or try this link:

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