“1881 – Operation not allowed when innodb_forced_recovery > 0.” Error on Joomla Site

A new client called us yesterday and told us that the website of the company he works for is down. He told us that it was displaying a weird error.

We immediately visited the website, and we noticed that it was displaying the below error (in red):

“1881 – Operation not allowed when innodb_forced_recovery > 0.” Error on Joomla Site

Luckily, we knew what innodb_forced_recovery is as we have used it before: it’s a MySQL setting in the my.cnf file (the MySQL configuration) and it is used to recover a MySQL database using the InnoDB storage setting after a crash.

We thought, could it be that the MySQL database crashed, and someone tried to recover the database, and it didn’t recover properly so he forgot the innodb_forced_recovery setting in the my.cnf file? So, we logged in to to phpMyAdmin and, to our pleasant surprise, the database was working and all the tables were OK. So, the prevailing theory here is that the database did crash, someone tried to recover the database, the recovery worked, but that person didn’t even test the website possibly because he thought that the recovery failed because it was taking a lot of time (and, as such, forgot to remove innodb_forced_recovery setting). Now, all we had to do was to comment out (or remove) the innodb_forced_recovery setting from the my.cnf file. We did this the following way:

  • We ssh’d to the server as root.
  • We opened, using vi, the file my.cnf which is located under the /etc folder.

  • We commented out the following line by adding a hash (#) to its beginning (note: you can also remove the line altogether):

    innodb_force_recovery = 2

  • We restarted MySQL by issuing the following command:

    service mysql restart

  • We checked the website and this time it worked! Yoohoo!

Now, if you’re the curious type, then you might be wondering what it means when innodb_force_recovery has a value of 2, and whether it can have different values. In short, the innodb_force_recovery can have values ranging from 0 to 6.

If innodb_force_recovery = 0, then recovery is disabled (this means normal operation).

If innodb_force_recovery = 1, then recovery is enabled, but it’s the most basic recovery and should be used when only little corruption has occurred to the database.

The higher the value of the innodb_force_recovery, the more aggressive (and dangerous) the recovery is. A value of 6 should only be used when all other options were exhausted, this is because it can make the problem even worse by permanently and irreversibly corrupting the database. You can read more about innodb_force_recovery = 1 on MySQL’s official documentation (note: external link).

We hope that you found this short post useful. If you are having the same problem and if you need help implementing the solution, then please contact us. Our fees are right, our work is professional, we are based in the lovely city of Montreal, and we are Joomla experts!

No comments yet.

Leave a comment