Error establishing a database connection on Contabo VPS
I have 4 WordPress websites hosted by Contabo VPS, one day one of the websites could not be accessed with the message “Error establishing a database connection”.
When I checked with other websites on the same server I found all experiencing the same error. After searching for the answer I found that I need to restart the server.
Restarting the server
There are 3 methods to restart the server via command prompt and via Contabo dashboard. If you can access to console, I highly recommend restarting it from there.
1. Restarting server via Telnet using command prompt
Login as root via Telnet connection (using Putty) type sudo reboot and press enter key or sudo shutdown -r and press enter key.
2. Restarting server via VNC Client using command prompt
Reboot server using VNC Client such as Real VNC Viewer is the same as using Telnet but this connection is less secure because the connection is not encrypted.
3. Restarting server via Contabo Dashboard
If you cannot access to command prompt, you can still access it via the Contabo dashboard, but this is not recommended because it’s like a hard reset. If doing this many times your file system can get corrupted.
1 week later I found that the Cron schedule causing this problem, at the moment I disable the Cron job from WP config. Since then I never experienced the same problem again.