Solve AApanel Error critical recovery information (last binlog or tc.log file) was manually deleted after a crash

Posted on

aaPanel is an easy but powerful control panel for Linux servers. one-click install LNMP/LAMP/OpenLiteSpeed developing environment and software.

When you use the aapanel panel, have you ever had a problem like this?

[ERROR] Found 1 prepared transactions! It means that mysqld was not shut down properly last time and critical recovery information (last binlog or tc.log file) was manually deleted after a crash. You have to start mysqld with –tc-heuristic-recover switch to commit or rollback pending transactions.

AApanel Error critical recovery information

And your database cannot start or restart. Very annoying, isn’t it?

Okay, on this occasion, I will briefly explain how to solve the problem automatically

in this tutorial I am using MariaDB 10.4.12

How to solve AApanel Error critical recovery information (last binlog or tc.log file) was manually deleted after a crash

1. First, open the AAPANEL dashboard

2. Login with your user and password

3. Open cron

4. Add Cron Job

5. Setting Type of Task: shell script; Name of Task: MariaDB Fix; Execution cycle: 5 minute

6. Fill Script content with it:

#!/bin/bash

# Check if MySQL is running
sudo service mysql status > /dev/null 2>&1

# Restart the MySQL service if it’s not running.
if [ $? != 0 ]; then
sudo -u mysql mysqld_safe –tc-heuristic-recover=commit
/bin/systemctl restart mysql.service
fi

7. Test using Action: Execute

8. Check your MariaDB, whether it is on or not

9. if it doesn’t work, try double-checking the script

Note: the script will check the status of MariaDB; if the condition MariaDB is off, then the script will fix it and restart the MariaDB

Hopefully useful and good luck