saving . . . saved getting database connection failed has been deleted. getting database connection failed has been hidden .
getting database connection failed

 I am getting the following error while installing moodle can u please give the solution.

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

Warning<span style="color: rgb(185, 74, 72); font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 14px; background-color: rgb(242, 222, 222);">: mysqli::__construct(): (HY000/1045): Access denied for user 'moodle-st'@'localhost' (using password: YES) in </span>C:\moodle\server\moodle\lib\dml\mysqli_native_moodle_database.php<span style="color: rgb(185, 74, 72); font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: 14px; background-color: rgb(242, 222, 222);"> on line </span>79

Moodle-Learning-Management-System Installing-Moodle-on-Local-Server 04-05 min 0-10 sec 29-04-20, 6:11 p.m.


The error says 'Access denied for user 'moodle-st'@'localhost' (using password: YES)'

A few points to be taken into consideration are:
- Have you entered the password for the database user 'moodle-st' correctly while entering database info during installation?
- And is the user 'moodle-st' granted with the correct permissions for the moodle database?

Solution can be -
You can try creating a new database user and a new db as well.
Commands for Ubuntu OS -
1] Login to mysql as a 'root' user. In terminal type: sudo mysql -u root -p 
Enter root password.

2] If not created already, or since you are at an initial phase, you can create database afresh for Moodle:
mysql> CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

3] Create a user/password combination with appropriate permissions for the database:

4] Exit from mysql.

Now, continue with Moodle installation and enter the details for database as set above:
Database: moodle
Database user: moodleuser
Db password: yourpassword

For Windows:
You need to create a database and a database user first.
- Go to http://localhost/moodle. The language select page should come up and you are away. 
- Data directory is C:\moodledata (or whatever you created)
- Database is 'moodle' (name of the database you created)
- Database user is 'root' (unless you created a more restricted user as shown above for your system)
- Database password is whatever you set installing MySQL

Helpful links for Windows OS-

If you are still facing issues after this, please send screenshots of the error if possible.

A few helpful posts from Moodle forums:

You can also check the database details in config.php file (if it has been generated) located at C:\moodle\server\moodle\config.php.

Please let me know if you have any further issues.
29-04-20, 7:30 p.m. kashmira.n

A few more helpful links - 

A few older version docs which might give you some ideas - 

30-04-20, 10:41 p.m. kashmira.n

Log-in to answer to this question.