2

I am following the Moodle 3.0 dev installation.

In the database setting process there is an 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

Warning: mysqli::mysqli(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) inC:\Apache24\htdocs\moodle\lib\dml\mysqli_native_moodle_database.php on line 79

There is somebody who can tell me what to do in order to proceed.

Thanks

2 Answers 2

1

You must allow remote login on MySQL server to root user using the command below

To allow from localhost

GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*root_user_password' WITH GRANT OPTION 

To allow from anywhere

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY PASSWORD '*root_user_password' WITH GRANT OPTION 

To allow from some host X.X.X.X

GRANT ALL PRIVILEGES ON *.* TO 'root'@'X.X.X.X' IDENTIFIED BY PASSWORD '*root_user_password' WITH GRANT OPTION 

Note : Above command must be followed by FLUSH PRIVILEGES;& restart on MySQL service

1
  • 2
    It might be better to be specific about the address you want to allow allowing AnYONE is a horrible idea!
    – Ramhound
    Commented Jan 11, 2016 at 17:11
1

At the Linux or DOS prompt type

mysql -u root -p

Then the following will create a new root user id which can be logged in from anywhere. It also drops already created root to remove the possibility of problems. Warning: this is not the best solution in a production environment.

CREATE USER 'root'@'%' IDENTIFIED BY 'P@ssw0rd';
grant all privileges on *.* to 'root'@'%' WITH GRANT OPTION;
flush privileges;
drop user 'root'@'localhost';
drop user 'root'@'127.0.0.1';
drop user 'root'@'::1';
flush privileges;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .