Hello community!
I'm encountering a problem connecting my Moodle platform housed in a virtual machine to its database housed in SQLServer on the host machine. When I try to access my platform, I get this 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
This is my configuration:
- Technical information Host machine
- Operating system : Windows 10
- Hypervisor : VMware.Workstation.15.5.1.15018445
- DataBase : SQLServer Express 2017
- Browser : chrome, firefox
- Technical information virtual machine
- Virtual machine: CentOS-8.1.1911-x86_64-dvd1
- Server version: Apache/2.4.37
- Version Moodle précise : 3.9
- Version PHP 7.4
What I did:
In my Windows 10 physical machine, I installed a hypervisor and the SQLServer DBMS to house the data bade.
In my hypervisor, I created a virtual machine with CentOs 8 as operating system.
In the virtual machine, I installed :
- the Microsoft Drivers for PHP for SQL Server
- The apache server and PHP
- Then I migrated my Moodle platform to the /var/www/html directory of Apache.
In the configuration file in my Moodle folder, I put the information as in the table below:
$CFG->dbtype = 'sqlsrv'; |
|
$CFG->dblibrary = 'native'; |
|
$CFG->dbhost = 'DESKTOP-OUUVQUE\MSSQLSERVER2017'; |
Address and instance of the database server |
$CFG->dbname = 'formation'; |
Name of the database created in SQLServer |
$CFG->dbuser = 'formation'; |
User associated with the training database |
$CFG->dbpass = '****************'; |
Database password |
$CFG->prefix = 'form_'; |
Table prefix |
$CFG->dboptions = array ( 'dbpersist' => 0, 'dbport' => '', 'dbsocket' => '', 'dbcollation' => 'utf8mb4_unicode_ci', ); |
|
$CFG->wwwroot = 'http://192.168.43.128/formation'; |
Access address to the platform on the virtual machine |
$CFG->dataroot = '/var/www/moodledata'; |
Moodle data directory address |
$CFG->admin = 'admin'; |
|
$CFG->directorypermissions = 0777; |
|
require_once(__DIR__ . '/lib/setup.php'); |
|
Does anyone have any idea where the problem lies?
Thank you.