【问题标题】:The insert , update and delete et command are default work with Transactions in Mysql?在 Mysql 中,insert、update 和 delete et 命令是默认使用的吗?
【发布时间】:2015-05-06 10:42:51
【问题描述】:

mysql database中,我们对insertupdatedelete数据使用的命令默认是Transaction?

I mean to say, If we insert 1 corore rows from one table to another and the connection break from some reason, then the half rows are being insert or nothing would be insert? 

我在这里很困惑,它是否在事务中工作。

/usr/bin/mysqldump -h ${SYSTEMIP} -u${SOURCEUSER}  -p${SOURCEPASS} \
 --skip-add-drop-table -t --skip-lock-tables --single-transaction --skip-add-locks --complete-insert -e -q --skip-disable-keys \
 --where="id=${ID}" \ ${SOURCEDB} ${SOURCETABLE} | sed -e "s/${SOURCETABLE}/${TARGETTABLE}/g" >> /tmp/sample.sql;

从上面的脚本代码中 --single-transaction 是什么意思?

【问题讨论】:

  • 请大家在这里回答!
  • 什么是1 corore rows
  • @N.B.这意味着超过 1 个 carore 行被移动到另一个表。
  • 如何使用 shell script.meance 如何在 shell 脚本中使用提交和回滚
  • 请告诉我 /usr/bin/mysqldump -h ${SYSTEMIP} -u${SOURCEUSER} -p${SOURCEPASS} \ --skip-add-drop-table -t --skip -lock-tables --single-transaction --skip-add-locks --complete-insert -e -q --skip-disable-keys \ --where="id=${ID}" \ ${SOURCEDB} ${SOURCETABLE} | sed -e "s/${SOURCETABLE}/${TARGETTABLE}/g" >> /tmp/sample.sql;由此看来,--single-transaction 是什么?

标签: mysql transactions


【解决方案1】:

请检查自动提交是真/假。 如果 autocommit=1 则自动插入记录。

在您的设置中设置自动提交 false SET autocommit=0;

请参考以下链接

Mysql transaction

【讨论】:

  • Deddage 。这个提交和回滚..如何在Shell脚本中使用?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-10-05
  • 2012-06-19
  • 1970-01-01
  • 2011-05-16
  • 2013-08-29
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多