Moodle not connecting to database problem

Moodle not connecting to database problem

by Steven Day -
Number of replies: 3
I just finished moving Moodle to a new host and now get the following error message. Checking through past posts didn't help any. Any ideas what it might be? The new host is Surpass Hosting, which other Moodlers use. The config.php file appears correct.

Error: Moodle could not connect to the database.

  • It's possible the database itself is just not working at the moment.
  • The admin should also check that the database details have been correctly specified in config.php
  • Database host:
  • Database name:
  • Database user:
Average of ratings: -
In reply to Steven Day

Re: Moodle not connecting to database problem

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Sorry, but, you *have* setup config.php with the correct settings - are the parameters *really* blank as shown, or did you do that for security? I know you probably have but it is worth asking.

Have you attempted to connect to the database (however you normally do it) with exactly the same parameters that you used in config.php and made sure you can access the tables?
In reply to Howard Miller

Re: Moodle not connecting to database problem

by Steven Day -
Thanks Howard.

Yes, the config.php file settings were correct.

In the end, after waiting an hour, I was able access the site without changing anything.

But now I can't login. So, I'll keep working on it.

In reply to Steven Day

Re: Moodle not connecting to database problem

by Steven Day -
OK, back in business.

My host support staff got the db working properly; the login problem appears to have been due to the data directory sessions folder having the wrong permissions. Glad to have the site up and running again.

Thanks for all the help, once again.