---
name: "mysql_commit"
section: "3"
platform: "linux"
package: "mariadb"
version: "13.0.2-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/mysql_commit"
---

# mysql\_commit(3)

### Name

mysql\_commit - Commits the current transaction

### Synopsis

-

  ```
  #include <mysql.h>
  my_bool mysql_commit(MYSQL * mysql);
  ```

### Description

Commits the current transaction for the specified database connection. Returns zero on success, nonzero if an error occurred.

### Parameters

- •

  `mysql` is a connection identifier, which was previously allocated by **[mysql\_init(3)](/mysql_init/3.md)** and connected by **[mysql\_real\_connect(3)](/mysql_real_connect/3.md)**.

### Notes

Executing mysql\_commit() will not affected the behaviour of autocommit. This means, any update or insert statements following mysql\_commit() will be rolled back when the connection gets closed.

\== See also \* **[mysql\_autocommit(3)](/mysql_autocommit/3.md)** \* **[mysql\_rollback(3)](/mysql_rollback/3.md)**
