简体   繁体   English

innodb_force_recovery 未设置为零 [mysql]

[英]innodb_force_recovery doesn't set to zero [mysql]

I'm trying to execute a simple insert query to mysql database, but it gives me this error:我正在尝试对 mysql 数据库执行一个简单的插入查询,但它给了我这个错误:

 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.我试图将 innodb_force_recovery 设置为零,但它给了我同样的错误。 I tried to add the following line to the my.ini file under [mysqld]:我尝试将以下行添加到 [mysqld] 下的 my.ini 文件中:

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?有谁知道如何解决这个问题?

This issue occurs when MySQL is in read-only mode.当 MySQL 处于只读模式时会出现此问题。

Edit file /etc/my.cnf , and comment out the following line编辑文件/etc/my.cnf ,并注释掉以下行

# 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 .当此行被注释掉或不存在时,它会恢复为默认设置0

Step 1: Open my.cnf file in your server第 1 步:在您的服务器中打开 my.cnf 文件

nano /etc/mysql/my.cnf纳米 /etc/mysql/my.cnf

Step 2:第2步:

Compare your file content比较您的文件内容

[mysqld] [mysqld]

#innodb_force_recovery = 1 #innodb_force_recovery = 1

bind-address=0.0.0.0绑定地址=0.0.0.0

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

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

Step 3: After Making Changes Restart Mysql Server第 3 步:更改后重启 Mysql 服务器

systemctl restart mysql systemctl 重启 mysql

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM