0

I have installed Moodle 2.8 on CentOS 7.
I face a problem.

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

and my Config.php is as follow:

CFG->dbtype    = 'mariadb'                    
CFG->dblibrary = 'native'                   
CFG->dbhost    = '192.0.0.0'     
CFG->dbname    = 'moodle'            
CFG->dbuser    = 'moodle'                
CFG->dbpass    = 'password'      

and my data path is:ver/moodledata and Document root is :var/www/html/moodle

How can I solve this problem. Please help me.I am new in moodle.

Russell England
  • 9,436
  • 1
  • 27
  • 41
24al
  • 59
  • 3
  • 8
  • The database and user has already been created? I'm also presuming the $ has been missed out during copy and paste - it should be $CFG not CFG - maybe try `$CFG->dbhost = 'localhost';` - if none of that works then its a problem with the database. Try the mariadb equivalent of `mysql -u moodle -p -h 192.0.0.0 moodle` – Russell England Jul 01 '15 at 11:43
  • Many Thanks.yes $ has been missed out during copy.i have tried also with $CFG->dbhost = 'localhost' it doesn't work again.i use this command mysql -u moodle -p -h 192.0.0.0 moodle and result is:ERROR 1130 (HY000): Host is not allowed to connect to this MariaDB server – 24al Jul 02 '15 at 10:51

1 Answers1

1

Okay so looks like an issue with the database rather than moodle.

This might have the answer - ERROR 1130 (HY000): Host '' is not allowed to connect to this MySQL server

Try that then try the command line again

mysql -u moodle -p -h 192.0.0.0 moodle

If the command line works then Moodle should work.

Community
  • 1
  • 1
Russell England
  • 9,436
  • 1
  • 27
  • 41