You can call the mysql_rollback() function to roll back the current transaction.
Syntax
my_bool
mysql_rollback(MYSQL *mysql)
Return values
0 is returned for an execution success, and a non-zero value is returned for errors.
Errors
None.
Notes
The action of this function is determined by the value of the completion_type system variable. If the value of completion_type is RELEASE or 2, after the transaction is terminated and the connection with the client is closed, the server will release the connection.
You can call the mysql_close() function on the client program to close the connection from the client side.