Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 616189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:17:59+00:00 2026-05-13T18:17:59+00:00

I have a web app that has been written with the assumption that autocommit

  • 0

I have a web app that has been written with the assumption that autocommit is turned on on the database, so I don’t want to make any changes there. However all the documentation I can find only seems to talk about using init_connect on the database, i.e. a global setting for all client connections.

Is there a way to set autocommit=0 just when running mysql on a Linux command line (without having to type it in every time)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T18:18:00+00:00Added an answer on May 13, 2026 at 6:18 pm

    Perhaps the best way is to write a script that starts the mysql command line client and then automatically runs whatever sql you want before it hands over the control to you.

    linux comes with an application called ‘expect’. it interacts with the shell in such a way as to mimic your key strokes. it can be set to start mysql, wait for you to enter your password. run further commands such as SET autocommit = 0; then go into interactive mode so you can run any command you want.

    for more on the command SET autocommit = 0; see.. http://dev.mysql.com/doc/refman/5.0/en/innodb-transaction-model.html

    I use expect to log in to a command line utility in my case it starts ssh, connects to the remote server, starts the application enters my username and password then turns over control to me. saves me heaps of typing 🙂

    http://linux.die.net/man/1/expect

    DC

    Expect script provided by Michael Hinds

    spawn /usr/local/mysql/bin/mysql 
    expect "mysql>" 
    send "set autocommit=0;\r" 
    expect "mysql>" interact
    

    expect is pretty powerful and can make life a lot easier as in this case.

    if you want to make the script run without calling expect use the shebang line

    insert this as the first line in your script (hint: use which expect to find the location of your expect executable)

    #! /usr/bin/expect
    

    then change the permissions of your script with..

    chmod 0744 myscript
    

    then call the script

    ./myscript
    

    DC

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a web app built on Jboss that has been in production for
I have a web app that up until now has been skinned (just basic
I have an existing web app that has a data layer and a bll
I have a very simple Mac Cocoa app that just has a Web View
I have been working on an iPhone app that has a feature of uploading
I am working on a web app project that has been in development for
I am writing a web app that uses HTML5 audio. I want to make
I have an MVC 3 web app that has an Action which I need
I am building a Django powered web app that has a large database component.
I have a Django webapp that has both a front-end, web-accessible component and an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.