Your Moodle database running on MariaDB may not start because of a number of reasons. From my experience on different Moodle Installations, the causes are not the same every time it happens,
On one of the installations, I found out that there was no more disk space left and querying mariadb status with systemctl status mariadb.service showed the MariaDB server was not running any more. Create more space may be by deleting some backups and try starting mariadb. Other solutions on other occasions included the following:
###########################
Another solution:
After deleting /var/lib/mysql/tc.log and restarting everything worked fine again.
###########################
Another solution:
Edit the file located at /etc/mysql/conf.d: sudo nano mysql.cnf
Adding a line open_files_limit = 30000 in that file