Sponsored Content
Top Forums Web Development [Solved] Disable mySQL autocommit Post 302532025 by Scott on Sunday 19th of June 2011 10:42:01 AM
Old 06-19-2011
[Solved] Disable mySQL autocommit

Hi.

Does anyone know how I can disable auto-commit in mySQL?

I've been Googling it for ages, and one suggestion that always comes up is adding this to /etc/my.cnf:

Code:
[mysqld]
...
init_connect='SET autocommit=0'

But that didn't work. I then read that this wouldn't work anyway for a priviliged user, so I created another user with very basic rights (select, insert, update, delete), and still it doesn't work.

So, thinking it might be because I was connecting from localhost, I installed a new VM and mySQL, and, after messing around for ages with iptables, managed to connect remotely to the mySQL server. But still it auto-commits.

I'm probably doing / missing something stupid, and it's driving me up the wall, so any help would be greatly appreciated.

TIA.

Code:
[scott@localhost ~]$ mysql --version
mysql  Ver 14.12 Distrib 5.0.77, for redhat-linux-gnu (x86_64) using readline 5.1

[scott@localhost ~]$ uname -a
Linux localhost.localdomain 2.6.18-238.12.1.el5 #1 SMP Tue May 31 13:22:04 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux

[scott@localhost ~]$ cat /etc/redhat-release 
CentOS release 5.6 (Final)

 

7 More Discussions You Might Find Interesting

1. AIX

how to set AUTOCOMMIT option in AIX

Hi, Can anybody tell,how to set the auto commit option in AIX,i have tried with environmental variables option like 'export db2option=-c +a'. But its not working in my environment. is there any other option? (1 Reply)
Discussion started by: DB2AIX
1 Replies

2. Shell Programming and Scripting

How to disable Enable/Disable Tab Key

Hi All, I have bash script, so what is sintax script in bash for Enable and Disable Tab Key. Thanks for your help.:( Thanks, Rico (1 Reply)
Discussion started by: carnegiex
1 Replies

3. UNIX for Dummies Questions & Answers

[SOLVED] mysql.sock is missing..

mysql.sock file is missing in /opt/lampp/etc/ is there any backup file available in unix... since without that file .. project is not opening.. reply me as soon as possible ... (19 Replies)
Discussion started by: senkerth
19 Replies

4. UNIX and Linux Applications

command to check value of autocommit and isolation level

Hi, Pls let me know command to get following: 1. how to check current value of autocommit 2. how to check current value of isolation level I am using mysql-5.0.26 on unix -Thanks (2 Replies)
Discussion started by: newbielgn
2 Replies

5. Red Hat

SSL/TLS renegotiation DoS -how to disable? Is it advisable to disable?

Hi all Expertise, I have following issue to solve, SSL / TLS Renegotiation DoS (low) 222.225.12.13 Ease of Exploitation Moderate Port 443/tcp Family Miscellaneous Following is the problem description:------------------ Description The remote service encrypts traffic using TLS / SSL and... (2 Replies)
Discussion started by: manalisharmabe
2 Replies

6. Emergency UNIX and Linux Support

[Solved] EMERGENCY - can I revert 1 hour of mysql changes

I know, its stupid.. MYSQL on CENTOS 5 using WHM Imported a lot of users/posts from old forum to new forum, but my backup was lost. Can I somehow simply remove all mysql table changes for the last 3 hours, returning to pre-import status. ---------- Post updated at 03:44 AM ----------... (6 Replies)
Discussion started by: lawstudent
6 Replies

7. Emergency UNIX and Linux Support

[Solved] Mysql - Take data from row and copy it to another row

Sorry if I repost my question in this section, but I'm really in a hurry since I have to finish my work... :( Dear community, I have a table with two rows like: Row1 Row2 ======= ======= 7,3 text 1 1,3 text 2 1,2,3 blabla What i need to do is add/copy... (2 Replies)
Discussion started by: Lord Spectre
2 Replies
MAXDB_ROLLBACK(3)							 1							 MAXDB_ROLLBACK(3)

maxdb_rollback - Rolls back current transaction

       Procedural style

SYNOPSIS
bool maxdb_rollback (resource $link) DESCRIPTION
Object oriented style bool maxdb::rollback (void ) Rollbacks the current transaction for the database specified by the $link parameter. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 Object oriented style <?php $maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB"); /* check connection */ if (maxdb_connect_errno()) { printf("Connect failed: %s ", maxdb_connect_error()); exit(); } /* disable autocommit */ $maxdb->autocommit(FALSE); $maxdb->query("CREATE TABLE temp.mycity LIKE hotel.city"); $maxdb->query("INSERT INTO temp.mycity SELECT * FROM hotel.city"); /* commit insert */ $maxdb->commit(); /* delete all rows */ $maxdb->query("DELETE FROM temp.mycity"); if ($result = $maxdb->query("SELECT COUNT(*) FROM temp.mycity")) { $row = $result->fetch_row(); printf("%d rows in table mycity. ", $row[0]); /* Free result */ $result->close(); } /* Rollback */ $maxdb->rollback(); if ($result = $maxdb->query("SELECT COUNT(*) FROM temp.mycity")) { $row = $result->fetch_row(); printf("%d rows in table mycity (after rollback). ", $row[0]); /* Free result */ $result->close(); } /* Drop table myCity */ $maxdb->query("DROP TABLE temp.mycity"); $maxdb->close(); ?> Example #2 Procedural style <?php $link = maxdb_connect("localhost", "MONA", "RED", "DEMODB"); /* check connection */ if (maxdb_connect_errno()) { printf("Connect failed: %s ", maxdb_connect_error()); exit(); } /* disable autocommit */ maxdb_autocommit($link, FALSE); maxdb_query($link, "CREATE TABLE temp.mycity LIKE hotel.city"); maxdb_query($link, "INSERT INTO temp.mycity SELECT * FROM hotel.city"); /* commit insert */ maxdb_commit($link); /* delete all rows */ maxdb_query($link, "DELETE FROM temp.mycity"); if ($result = maxdb_query($link, "SELECT COUNT(*) FROM temp.mycity")) { $row = maxdb_fetch_row($result); printf("%d rows in table mycity. ", $row[0]); /* Free result */ maxdb_free_result($result); } /* Rollback */ maxdb_rollback($link); if ($result = maxdb_query($link, "SELECT COUNT(*) FROM temp.mycity")) { $row = maxdb_fetch_row($result); printf("%d rows in table mycity (after rollback). ", $row[0]); /* Free result */ maxdb_free_result($result); } /* Drop table myCity */ maxdb_query($link, "DROP TABLE temp.mycity"); maxdb_close($link); ?> The above example will output something similar to: 0 rows in table mycity. 25 rows in table mycity (after rollback). SEE ALSO
maxdb_commit(3), maxdb_autocommit(3). PHP Documentation Group MAXDB_ROLLBACK(3)
All times are GMT -4. The time now is 09:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy