Dino Geek, try to help you

How can I manage transactions in MariaDB?


Managing transactions in MariaDB involves starting a transaction, executing the desired queries, and then stating whether you want to commit (if the execution was successful) or rollback (if errors are encountered).

Here is a simple example of how to manage transactions in MariaDB:

```
START TRANSACTION;

INSERT INTO table_name (column1, column2, column3)
VALUES (value1, value2, value3);

/* At this point, you can choose whether to commit or rollback the transaction */

/* In case of successful execution */
COMMIT;

/* In case of errors */
ROLLBACK;
```

In a transaction, changes will not be made to the database until a COMMIT command is issued. If a ROLLBACK command is issued, all changes made after the last COMMIT command will be undone.

Also, you can use `SET autocommit = 0;` before starting a transaction, which means after every query changes will not be permanent until you use `COMMIT;`. This can be useful when you have a lot of statements in a transaction. In the end, you can set `SET autocommit = 1;` to go back to the default behavior.

Keep in mind that not all the tables support transactions. The tables should be of InnoDB storage engine type to support transactions. Hope this helps.


Simply generate articles to optimize your SEO
Simply generate articles to optimize your SEO





DinoGeek offers simple articles on complex technologies

Would you like to be quoted in this article? It's very simple, contact us at dino@eiki.fr

CSS | NodeJS | DNS | DMARC | MAPI | NNTP | htaccess | PHP | HTTPS | Drupal | WEB3 | LLM | Wordpress | TLD | Domain name | IMAP | TCP | NFT | MariaDB | FTP | Zigbee | NMAP | SNMP | SEO | E-Mail | LXC | HTTP | MangoDB | SFTP | RAG | SSH | HTML | ChatGPT API | OSPF | JavaScript | Docker | OpenVZ | ChatGPT | VPS | ZIMBRA | SPF | UDP | Joomla | IPV6 | BGP | Django | Reactjs | DKIM | VMWare | RSYNC | Python | TFTP | Webdav | FAAS | Apache | IPV4 | LDAP | POP3 | SMTP

| Whispers of love (API) | Déclaration d'Amour |






Legal Notice / General Conditions of Use