enter's picture

Hi,

I am just trying to launch a new Moodle Server from my Turnkey Hub in aws. I tried different sizes (I wanted the micro), different passwords... and I always get this:

------------------ 

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

----------------

Funny thing is that I have been doing that for a while over the last years without any issue. Last time it was 14 months ago and now following the same method I cannot start.

I tried the usual supects (reboot, restart mysql,...) Any help would be really appreciated.

Regards

Forum: 
Jeremy Davis's picture

It should still work fine, but obviously me saying that isn't much help! :)

Once it has finished booting, perhaps try logging in with SSH and run

turnkey-init

You'll need to re-enter passwords (you can reuse the ones you used before) but that should solve the issue. Let me know how you go.

enter's picture

It totally did the trick, everything is working as usual.

Thank you very much for your detailed and speedy feedback


Jeremy Davis's picture

Regardless we are looking into why this issue occurred in the first place. It is an intermittent issue but I do seem to be able to reproduce it fairly regularly so there is obviously something not quite right going on...

So thanks for reporting in the first place! :)

Jeremy Davis's picture

This mostly will apply to TurnKey Linux. If you're using something else then only the second part (restarting MySQL &/or getting a bigger server) will apply.

How you "SSH in" (i.e. log in remotely using Secure SHell) will depend on what operating system you are using. Linux and OSX open commandline and type:

ssh root@x.x.x.x
Where "x.x.x.x" is your server's IP address. On windows it's a bit more convoluted because it doesn't come with an SSH client pre-installed. I recommend that you use PuTTY. It should be relatively straight forward to use it. If you get stuck I suggest that you google. Should be tons of examples/tutorials online.

If you have only just launched your server then you could try re-running the inithooks. I.e.:

turnkey-init
But if it's a server that has already been running (successfully) then it's probably just that MySQL crashed. Most common cause of that (in a micro server) is due to running out of RAM. The short term solution to that is to just restart MySQL:
service mysql start
The longer term solution is to use a bigger server with more resources (RAM in particular if your general performance is acceptable).
Fabian's picture

I did the same procedure and the same thing keeps coming to me I'm so without solving I did was noodle 2.9 update if reboot is disconnected help me please. Thanks a lot in advance 

 

 

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

Jeremy Davis's picture

Is MySQL running (service mysql status)?

If so then maybe something has changed in the config file (or it's in a different location)?

If so then it's probably that the moodle DB user password is wrong. Check to see if you can log into MySQL (using phpMyAdmin) as the moodle user using the DB password found in the moodle config file. If that doesn't work reset the moodle DB user password (again in phpMyAdmin, using the root account this time).

Hopefully that should solve the issue...

Add new comment