S
S
Stanislav Kolosov2020-09-10 10:00:01
System administration
Stanislav Kolosov, 2020-09-10 10:00:01

Error: Database connection failed what's wrong?

I created the basis for the moodle server according to this guide: pyatilistnik.org/kak-ustanovit-moodle-na-centos-7-...
Before connecting the database in config.php, everything went fine, after the connection problem began. When navigating to " 85.91.96.212/moodle " gives the 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"

What's the matter is not very clear, it's clear that the matter is in setting up the config, but everything that I found on the Internet for 2 days did not help at all from the word.

Everything that I changed in the config according to the guide looks like this:
$CFG->dbtype='mariadb';
$CFG->dlibrary='native';
$CFG->dbhost='85.91.96.212';
$CFG->dbname='moodledb';
$CFG->dbuser=username;
$CFG->dbpass=password;

$CFG->wwwroot= '85.91.96.212 ';

$CFG->dataroot='/var/moodle/data';

I made two bases according to the example in the link, but none of them worked, most likely I screwed up somewhere in the syntax. php is set fresh, not as in the guide. What could be the cause of the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
latush, 2020-09-10
@latush

Most likely, MySQL only accepts connections on localhost.
Change
$CFG->dbhost='127.0.0.1';

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question