简体   繁体   English

没有交易的生活(MyISAM)

[英]Life without transactions (MyISAM)

My site runs on a VDS-server. 我的站点在VDS服务器上运行。 I've just found out that my MySQL server doesn't support InnoDB engine, therefore I can't use database transactions in my application. 我刚刚发现我的MySQL服务器不支持InnoDB引擎,因此无法在应用程序中使用数据库事务。

It makes me think, that some people might never use transactions. 我认为有些人可能永远不会使用交易。 Is this the case? 是这样吗 If so, how does one manage to coordinate related operations on different tables in MyISAM? 如果是这样,如何在MyISAM中协调不同表上的相关操作?

Otherwise, is there a way to install InnoDB on a MySQL server which is run on a VDS? 否则,是否有办法在VDS上运行的MySQL服务器上安装InnoDB?

Thanks! 谢谢!

If you need transactions, then you need transactions and MyISAM isn't going to cut the mustard. 如果您需要交易,那么就需要交易,而MyISAM不会削减芥末酱。

Some applications won't need transactions. 某些应用程序不需要交易。 For example; 例如; an application that never runs more than one related SQL statement at a time and has no need to rollback multiple SQL statements. 一种应用程序,它永远不会一次运行多个相关的SQL语句,并且不需要回滚多个SQL语句。 Another example is an application that uses MySQL as a simple Key-Value Store. 另一个示例是一个使用MySQL作为简单键值存储的应用程序。 There are many use cases that don't require database level transaction support. 有许多用例不需要数据库级事务支持。

It's hard to answer the second part of your question without knowing more details about your VDS. 如果不了解有关VDS的更多详细信息,很难回答问题的第二部分。 Who is you hosting provider? 您是谁的托管服务提供商? Do you have shell access and permissions to change my.cnf? 您具有外壳程序访问权限和更改my.cnf的权限吗? If not, then you probably won't be able to enable InnoDB. 如果没有,那么您可能将无法启用InnoDB。 If you do, then here is a another SO answer that details how to enable InnoDB on MySQL: How to enable INNODB in mysql 如果您这样做,那么这是另一个SO答案,其中详细说明了如何在MySQL上启用InnoDB: 如何在mysql中启用INNODB

You can often either enable the engine, install the InnoDB components manually, or simply re-install a version of MySQL that includes that engine by default. 您通常可以启用引擎,手动安装InnoDB组件,或者简单地重新安装默认情况下包含该引擎的MySQL版本。 MyISAM is the crazypants database, stupidly fast but also unreliable and prone to complete destruction if your system isn't shut down properly. MyISAM是疯狂的数据库,速度非常快,但是如果您的系统未正确关闭,它也不可靠并且容易完全破坏。

Running a mission critical application on MyISAM is an extremely bad idea. 在MyISAM上运行关键任务应用程序是一个非常糟糕的主意。 Where you need MyISAM tables for performance reasons they should always be disposable, easily re-built from another more reliable source of data. 由于性能原因而需要MyISAM表的地方,它们应该始终是可抛弃的,并可以从另一个更可靠的数据源轻松重建。

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

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