将表类型从 MyISAM 更改为 InnoDB
我想知道如果我将一些表从 MyISAM 转换为 InnoDB,会导致数据损坏吗?
我需要将一些表转换为 InnoDB,以便我可以使用事务,但它们保存着非常重要的数据,所以我不确定是否应该进行转换。
I wonder if I convert some tables from MyISAM to InnoDB, will it cause any corruptions of data?
I am in need to convert some tables to InnoDB so I can use transaction, but they are holding very important data so I'm not sure if I should do the conversion or not.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
虽然更改表的数据库引擎是一项简单而常见的任务,不会导致损坏,但保证不会发生损坏的唯一方法是首先进行自己的备份。
While changing the database engine of a table is a simple and common task which should cause no corruption, the only way to guarantee no corruption can occur is to first make your own backup.
当然,数据丢失的风险始终存在;但总的来说我认为它相当低。
当更改表时,MySQL 将为大多数操作(包括此操作)处理临时副本。因此,如果操作失败,也不会损害您的原始表。
无论如何,拥有备份会让你感觉更好......
Of course there is always a risk of data loss; but overall I would consider it rather low.
When altering a table MySQL will work on a temporary copy for most operations, including this one. So if the operation fails it will not harm your original table.
And having a backup will make you feel better anyway...
MySQL 的设计使得表类型之间的转换非常稳健。
除了进行转换所需的时间之外,数据面临的唯一风险是数据库运行时的正常背景风险。也就是说,无论如何你都应该有备份,如果不丢失任何重要的东西,你可能应该有复制。
MySQL has designed it so that converting between table types is designed to be robust.
The only risk to your data, other than the time it takes to do the conversion, is the normal background risk that you would have at any time your database is running. That is to say, you should always have backups anyway, and if not losing anything is important, you should probably have replication.