search

Home  >  Q&A  >  body text

mysql如果一个事务一直没有commit并且也没有rollback会怎样?

mysql如果一个事务一直没有commit并且也没有rollback会怎样?
有什么办法查询到这些没有被commit也没有被rollback的事务。?

巴扎黑巴扎黑2785 days ago948

reply all(4)I'll reply

  • PHPz

    PHPz2017-04-17 13:48:53

    If there is an uncommitted transaction in MySQL, then the AUTOCOMMIT automatic submission parameter should be 0 at this time.
    However, if you operate through MySQL drivers in other languages, these drivers generally have the function of automatically recovering AUTOCOMMIT. After the request processing is completed, unprocessed transactions will be automatically ROLLBACKed.

    reply
    0
  • 阿神

    阿神2017-04-17 13:48:53

    When the connection times out, transactions that have not been committed on that connection will be rolled back

    reply
    0
  • ringa_lee

    ringa_lee2017-04-17 13:48:53

    1. When the link is disconnected, it will automatically rollback
    2. When there is a deadlock or the lock times out, it will also rollback

    reply
    0
  • 黄舟

    黄舟2017-04-17 13:48:53

    When the database connection is disconnected or the request ends, it will usually rollback automatically

    This is the answer everyone will give, but is it actually the rollback of the server, the startup environment (FPM), or the connection library operation of the code? ? ? Not sure, but my guess is that the tool class connected to the database automatically rollbacks, or the startup environment (FPM) automatically rollbacks directly when the server is ready to return data to the client

    There are also official documents on the Internet, for example, PHP-mysql is a rollback automatically called by PDO (database driver library). But it didn’t say when exactly it would be disconnected. . .

    reply
    0
  • Cancelreply