简体   繁体   English

MySql的:InnoDB_Force_recovery = 1导致只读表

[英]MySql : InnoDB_Force_recovery = 1 leads to table in read only

I have an application which runs under MariaDB 10.1.18 and I had problems of data corruption. 我有一个在MariaDB 10.1.18下运行的应用程序,我遇到了数据损坏的问题。 So, in my.cnf I change the parameter innoDB_force_recovery = 1 to ignore them. 因此,在my.cnf中,我将参数innoDB_force_recovery = 1更改为忽略它们。 But then, I can not make insert in tables. 但是然后,我无法在表中进行插入。 But I thought that insert are forbidden when innoDB_force_recovery = 4. Is it possible to make insert when innoDB_force_recovery = 1 ? 但是我认为innoDB_force_recovery = 4时禁止插入。innoDB_force_recovery = 1时可以插入吗? Best regards. 最好的祝福。 Christophe 克里斯多夫

Setting innodb_force_recovery=1 does not fix data corruption! 设置innodb_force_recovery=1不能修复数据损坏! It ignores corruption to allow you to back up your data before rebuilding the database. 忽略损坏,从而允许您在重建数据库之前备份数据。

Only set this variable to a value greater than 0 in an emergency situation, so that you can start InnoDB and dump your tables. 仅在紧急情况下将此变量设置为大于0的值,以便您可以启动InnoDB并转储表。 As a safety measure, InnoDB prevents INSERT, UPDATE, or DELETE operations when innodb_force_recovery is greater than 0. 作为安全措施,当innodb_force_recovery大于0时,InnoDB会阻止INSERT,UPDATE或DELETE操作。

So, no. 所以不行。 You cannot insert data while innodb_force_recovery is active. innodb_force_recovery处于活动状态时,您无法插入数据。 Use mysqldump to create a backup of all data, then delete the MySQL data files and use your backup to restore it. 使用mysqldump创建所有数据的备份,然后删除MySQL数据文件并使用您的备份来还原它。

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

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