MySQL 当 innodb_forced_recovery > 0 [SqlYog] 时不允许操作

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25155777/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 12:57:03  来源:igfitidea点击:

Operation not allowed when innodb_forced_recovery > 0 [SqlYog]

mysqlsqlsqlyog

提问by RK.

I have created a table using SQLyog. When i insert values into it, it pops up following error message:

我使用 SQLyog 创建了一个表。当我向其中插入值时,它会弹出以下错误消息:

Operation not allowed when innodb_forced_recovery > 0.

My table consist only four columns including one primary key. Following is my create and insert queries:

我的表只包含四列,包括一个主键。以下是我的创建和插入查询:

CREATE TABLE `news` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `title` varchar(100) NOT NULL,
  `slug` varchar(100) NOT NULL,
  `descr` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1

insert into `test`.`news` (`title`, `slug`, `descr`)
 values ('titleOne', 'slugOne', 'descOne')

回答by Somnath Muluk

This error is comes when MySQL is in Read only mode.

当 MySQL 处于只读模式时会出现此错误。

Edit file /etc/my.cnf.

编辑文件/etc/my.cnf

And comment out following line

并注释掉以下行

# innodb_force_recovery = 1

Apparently this setting causes innodb to become read-only. If you don't have access to /etc/my.cnf on shared hosting, ask your host to fix it for you. When it's commented out or non-existent in /etc/my.cnf, the it reverts to a default setting of 0.

显然,此设置会导致 innodb 变为只读。如果您无权访问共享主机上的 /etc/my.cnf,请让您的主机为您修复它。当它在 /etc/my.cnf 中被注释掉或不存在时,它会恢复为default setting of 0.

回答by Ubaz Zaria

This happens to me also but what i did was to change the SQL Engine during creatng the table from InnoDB to MyISAM like in ENGINE=innoDB to ENGINE=MyISAM

这也发生在我身上,但我所做的是在从 InnoDB 到 MyISAM 创建表的过程中将 SQL 引擎更改为 ENGINE=innoDB 到 ENGINE=MyISAM

So if you have your database and want to upload it, open it with any editor and change the engine at the end of each table from innoDB to MyISAM.

因此,如果您有数据库并想上传它,请使用任何编辑器打开它并将每个表末尾的引擎从 innoDB 更改为 MyISAM。

this resolved the problem.

这解决了问题。