Mariadb is corrup how to reinstall and restore backup

Hi,

My ERPNEXT VM was running quite fine and suddenly I got Internal Server Error message. I found db is corrupted and tried everything to recover but failed.
Finally I need some help from an expert to guide me how to reinstall mariadb server only and how I can restore db backup i have. So that everything other can be run smoothly as it was.

Thank you

Do you have a backup ?, if you do have a backup you can run bench restore with the path to the backup file

image

Thank you for the reply.

Pardon me, I am inefficient in ubuntu and operations.
Yes I have backup, one of my database, the name which I found from site1.local config file, and the one backup with --all-databases switch.

Now I don’t know how to remove previous corrupt mysql server and its data, how to re-install, how to configure and how to import he backup. Please guide for these if you dont mind. I am attaching the screenshot of systemctl status mariadb here.

Assuming you’ve already tried,

sudo systemctl restart mariadb

I would recomend you to restart your system, it could even fix your issues.

If it doesn’t you could clear your site database by running

bench reinstall

image

This would reinstall the site and wipe all data.

Thank you.

I tried everything you told here.
bench reinstall is not working error code of failed to connect to local database server.

I tried purging database server, but both Mysql Mariadb syntaxes I followed are failing.
I tried stopping mysql in init.d, it also of no use.

I just want to know how I can fully remove database server and its files/folders. Reinstall db server, and to restore my database.