Installing moodle 4 – Error during the Database settings in http://ip_address /moodle

Installing moodle 4 – Error during the Database settings in http://ip_address /moodle

Igor BastosMartins -
回帖数:2

Hi guys, I am trying to install moodle on a Ubuntu 22.04 with PHP Version 7.4.30 + Apache2 + 8.0.30. I am following this link https://docs.moodle.org/400/en/Step-by-step_Installation_Guide_for_Ubuntu in the step 7, it asked me to browse to  http://IP.ADDRESS.OF.SERVER/moodle and fill the form. In the Database settings to be more specific it is asking:

·         Database host: I try with localhost and with the server ip

·         Database name: moodle

·         Database user: moodleuser

·         Database password: my_password created in the step 6

·         Tables prefix: mdl_

·         Database port: 3306

·         Unix socket: I let it null

 

When I click in next, I am receiving the bellow error. Could some one help me? To validate the user/pass I executed this command sudo mysql -u moodleuser -p and when requested I type my pass I worked properly.

 

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: mysqli::__construct(): (HY000/1045): Access denied for user 'moodleuser'@'localhost' (using password: YES) in /var/www/html/moodle/lib/dml/mysqli_native_moodle_database.php on line 83

Regards, Igor Martins

回复Igor BastosMartins

Re: Installing moodle 4 – Error during the Database settings in http://ip_address /moodle

Ken Task -
Particularly helpful Moodlers的头像

https://docs.moodle.org/400/en/Step-by-step_Installation_Guide_for_Ubuntu

https://docs.moodle.org/400/en/Step-by-step_Installation_Guide_for_Ubuntu#Step_6:_Setup_MySQL_Server

The create user command and command to grant that user permissions. The parts about @localhost.   Must use super user creds to be able to do that.   @localhost is really using sockets.

mysql> show grants;

'SoS', Ken

回复Ken Task

Re: Installing moodle 4 – Error during the Database settings in http://ip_address /moodle

Igor BastosMartins -
Thanks Ken.
I just droped and then I re-created the user and then everything worked very well.
Regards, Igor Bastos Martins