I have Mariadb installed on a Raspberry Pi with a simple star schema for logging data that comes in on a Modbus server. Everything was running fine for about a month and a half until one day I was met with errors about a corrupt database page. This was the first time it happened. Luckily I had a backup SD that I was able to recover the system from.

Today it happened again when I was trying to figure out another error that was occurring when trying to perform a full backup. sudo mariabackup --backup --target-dir "${full_path}"/base --user=root within my own script: "full_backup.sh". The script has been working perfectly up until recently when I noticed the error. enter image description here

I wasn't sure if I ran sudo mysql_secure_installation when I reinstalled mariadb after the first recovery, so I ran it and answered 'Y' to everything as usual.

Then, when I restarted mariadb sudo systemctl restart mariadb.service I was met with the same error I had the first time. enter image description here

And when I looked in /var/log/mysql/error.log I saw the same error as last time there as well. enter image description here

The first time I ran into this problem I spent hours researching what might be causing it to no avail. I would greatly appreciate anyone out there who can help resolve this. Thank you.

Update 1: Tried following instructions here: https://mariadb.com/kb/en/library/what-to-do-if-mariadb-doesnt-start/ under the "Table Corruption" section. Clicked link to "InnoDB recovery mode" followed that rabbit hole and tried setting the variable to 1 like this: mysqld_safe --innodb-force-recovery=1 Checked the variable with: mysqld --verbose --help | grep recovery and the variable is not changing to 1. It stays set to 0.

Update 2: Out of desparation I tried uninstalling and reinstalling mariadb. sudo apt purge mariadb-server then sudo rm -rf /var/lib/mysql/ then sudo apt install mariadb-server Still getting the same error as before when I check sudo systemctl status mariadb I'm running out of ideas.

Update 3: Just did sudo apt purge mariadb* then sudo reboot. Now I can't SSH in. The Pi is at a remote location. What an absolute nightmare.

  • 1
    It's not exactly clear what your question is. How the file got corrupted? How to restore it? Something else? – mustaccio Apr 9 at 17:41
  • Why am I getting these errors? How can I recover the database to a working state? – ThriftyNick Apr 9 at 17:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.