Bug #51175 | Can't specify default value for autocommit | ||
---|---|---|---|
Submitted: | 14 Feb 2010 22:24 | Modified: | 10 Jan 2011 16:04 |
Reporter: | Tim Behrendsen | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: General | Severity: | S4 (Feature request) |
Version: | 5.1.42 | OS: | Any |
Assigned to: | Valeriy Kravchuk | CPU Architecture: | Any |
Tags: | autocommit |
[14 Feb 2010 22:24]
Tim Behrendsen
[15 Feb 2010 5:15]
Valeriy Kravchuk
What about init_connect server variable? Check http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_init_connect.
[15 Feb 2010 14:49]
Tim Behrendsen
Thank you for the response. Yes, I've tried to use that, but unfortunately that method has this wrinkle: > Note that the content of init_connect is not executed for users that have the > SUPER privilege. I'm limited in what I can tweak for the privileges of my connecting users, and I haven't been able to turn off autocommit because of the above restriction. It doesn't seem to be currently possible to turn off autocommit in all cases.
[15 Feb 2010 15:02]
Valeriy Kravchuk
Having many users with SUPER privilege is the problem by itself, but OK, for some cases your feature request makes sense it seems.
[15 Feb 2010 17:17]
Jim Winstead
I've changed the synopsis and categorization of this bug. It has very little to do with needing a .mysqlrc (which already exists in the form of my.cnf, etc) and everything to do with allowing the default value for autocommit to be set on the server in a way that doesn't depend on configuring all clients correctly.
[15 Feb 2010 18:00]
Tim Behrendsen
It is true that the core issue is disabling autocommit in a comprehensive way, but another issue is that I'm a little afraid to disable autocommit globally. I've seen references that importing and exporting can be affected by this. To try and combat setting it globally, I've experimented with putting: --------- [mysqld] init_connect="set autocommit=0" --------- ...in the .my.cnf for my local user, and it doesn't seem to work like putting in the global file. So that's been a problem (if I'm doing it wrong, please let me know). And even if I got this to work, I still have the user permissions problem. While it's true that .my.cnf serves somewhat the same purpose as a .mysqlrc file, the truth is that it's not very flexible. It would be much more flexible to be able to put *any* command into a start-up script. (Another idea that just occurred to me is to have a [startup] section in .my.cnf that would read commands, which would eliminate having another file.) I suppose what would totally solve my immediate problem is having a "--autocommit=0" on the mysql command line client. Then I could alias the mysql command to do that all the time, and wouldn't affect the rest of the system. That's probably the most "it ought to be there anyway" solution. But having the start-up script would be really cool. :) You could have it dump out database stats whenever you ran the mysql command. If you found yourself commonly creating a temporary table, you could have it do that. The possibilities of a start-up script are endless. Thanks for the responses!
[10 Jan 2011 16:04]
Valeriy Kravchuk
Actually, I'd say that fix for Bug#57316 (that allows to set autocommit globally, even for SUPER users, using init_connect) solves this problem. Now (since 5.5.8) there is a way to set default value of autocommit for all users.