TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

MySQL transactions are not safe (from the command line)

1 点作者 TrevorBurnham大约 14 年前

1 comment

TrevorBurnham大约 14 年前
Just wanted to call folks' attention to this, because I don't think it's well known. If you launch the mysql utility and connect to your database, you'd probably expect these three queries to do nothing:<p><pre><code> START TRANSACTION; UPDATE clients SET important_field = NULL; ROLLBACK; </code></pre> But if the connection is lost between the first and second queries, the mysql client will "auto-reconnect" and send the second query—even though it's no longer in a transaction.<p>You can disable this behavior using the --disable-reconnect flag.