我使用SQLyog创建了一个表.当我向其中插入值时,它会弹出以下错误消息:
Operation not allowed when innodb_forced_recovery > 0.
Run Code Online (Sandbox Code Playgroud)
我的表只包含四列,包括一个主键.以下是我的创建和插入查询:
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')
Run Code Online (Sandbox Code Playgroud)
Som*_*luk 16
MySQL处于只读模式时会出现此错误.
编辑文件/etc/my.cnf.
并注释掉以下行
# innodb_force_recovery = 1
Run Code Online (Sandbox Code Playgroud)
显然,此设置会使innodb变为只读.如果您无法访问共享主机上的/etc/my.cnf,请让您的主机为您进行修复.当它在/etc/my.cnf中被注释掉或不存在时,它将恢复为a default setting of 0.