Moodle 3.6.3 Database settings Error Code: 18456

Moodle 3.6.3 Database settings Error Code: 18456

by Michael Guizzetti -
Number of replies: 2

I'm running through the install process of Moodle 3.6.3 and am now stuck on the Database Settings page.  I'm getting the following error:


Error: Database connection failed

It is possible that the database is overloaded or otherwise not running properly.

The site administrator should also check that the database details have been correctly specified in config.php

SQLState: 28000
Error Code: 18456
Message: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Login failed for user 'domain\user'.


I have two Windows 2016 servers one with IIS and the other with SQL 2016. 


IIS Server

I've installed the Microsoft ODBC Driver 17 for SQL Server and the SQL drivers in the C:\Program Files\PHP\v7.2\ext folder "php_sqlsrv_72_nts_x64.dll" "php_pdo_sqlsrv_72_nts_x64.dll" and added the following to my php.ini:

[PHP_SQLSRV]

extension=php_pdo_sqlsrv_72_nts_x64.dll

extension=php_sqlsrv_72_nts_x64.dll


SQL server

I've created a DB  and enabled "SQL Server and Windows Authentication mode".  TCP/IP is also enabled.


I've run through as many forums as I can and the solutions are not working for my issue.  What am I missing?

Attachment Error.PNG
Average of ratings: -
In reply to Michael Guizzetti

Re: Moodle 3.6.3 Database settings Error Code: 18456

by Luis de Vasconcelos -

You can't connect using a domain account (domain\user) - at least, I could never get it to work. So, create a database user in SQL Server and use that username and password to connect the Moodle installer to the MSSQL database.

But first check that PHPInfo() shows the SQLSRV section? If not, your PHP isn't configured correctly.