1

I'm trying to execute a simple insert query to mysql database, but it gives me this error:

 Operation not allowed when innodb_forced_recovery > 0.

I'm trying to set the innodb_force_recovery to zero, but it give me the same error. I tried to add the following line to the my.ini file under [mysqld]:

innodb_force_recovery=0

But it doesn't work. I also tried to set it from command line:

--innodb_force_recovery=0;

But again it didn't work. Anyone knows how to solve this?

Blackecho
  • 1,226
  • 5
  • 18
  • 26
  • 2
    it must be set somewhere. grep -r innodb_force_recovery /etc/my.cnf /etc/mysql/* – akuzminsky Mar 14 '14 at 14:47
  • check if you have /usr/my.cnf – akuzminsky Mar 14 '14 at 14:48
  • I set it to 0, but now mysql does not start. This is the log error: http://pastebin.com/GxGCgVFg – Blackecho Mar 14 '14 at 14:55
  • Don't expect that innodb_force_recovery > 0 will fix your InnoDB tablespace. This option is intended to ignore some errors so you are able to take a dump of your data – akuzminsky Mar 14 '14 at 15:15
  • Possible duplicate of https://stackoverflow.com/q/25155777 – hongsy Jun 29 '21 at 04:51
  • Does this answer your question? [Operation not allowed when innodb\_forced\_recovery > 0 \[SqlYog\]](https://stackoverflow.com/questions/25155777/operation-not-allowed-when-innodb-forced-recovery-0-sqlyog) – hongsy Jun 29 '21 at 04:51

2 Answers2

0

This issue occurs when MySQL is in read-only mode.

Edit file /etc/my.cnf, and comment out the following line

# innodb_force_recovery = 1

If you don't have access to the file, ask your administrator to fix it. When this line is commented out or does not exist, it reverts to a default setting of 0.

hongsy
  • 1,498
  • 1
  • 27
  • 39
0

Step 1: Open my.cnf file in your server

nano /etc/mysql/my.cnf

Step 2:

Compare your file content

[mysqld]

#innodb_force_recovery = 1

bind-address=0.0.0.0

!includedir /etc/mysql/conf.d/

!includedir /etc/mysql/mysql.conf.d/

Step 3: After Making Changes Restart Mysql Server

systemctl restart mysql

JHM16
  • 649
  • 8
  • 12