Error establishing database connection after 2 days. Why?

Hello friends.

I followed docs installing three WordPress sites on my EE server. All three are WordPress with Redis cache. Everything was going great until this morning all sites had “Error establishing database connection” message. I rebooted the server and everything started working again. I was wondering is there a way to find out why it happened and if so is there any way to maybe restart or reboot server via cron or any other means once a day at midnight??

P.S. Today even rebooting of the server does not help. It says Error establishing database connection

Thank you for any info.

ee debug --mysql shows the following: (2003, "Can't connect to MySQL server on 'localhost' (111)")

service mysql start shows the following : `* Starting MariaDB database server mysqld [ OK ]

  • Checking for corrupt, not cleanly closed and upgrade needing tables.

`

All my sites are showing 502 bad gateway now