Bug #40078 can't set sql-mode in my.cnf for client
Submitted: 16 Oct 2008 13:03 Modified: 19 Feb 2010 13:52
Reporter: Marques Johansson Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S4 (Feature request)
Version:5.1 OS:Any
Assigned to: CPU Architecture:Any

[16 Oct 2008 13:03] Marques Johansson
Description:
http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html states that sql-mode can be set in the my.cnf file.  When attempting to use this variable, the mysql client will not start because it does not accept the option.

How to repeat:
mjohansson@bang:~$ mysql --version
mysql  Ver 14.12 Distrib 5.0.67, for debian-linux-gnu (i486) using readline 5.2

# place this under [client] in ~/.my.cnf: 
# sql-mode = "TRADITIONAL"

mjohansson@bang:~$ mysql 
mysql: unknown variable 'sql-mode=TRADITIONAL'
[16 Oct 2008 13:22] Marques Johansson
The mysql client doesn't offer a way to set the default sql-mode for the client.  http://dev.mysql.com/doc/refman/5.0/en/mysql-command-options.html

On another note, the server documentation http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html say that the sql-mode option is available, but doesn't mention that the option "sql-mode" must be found in the [mysqld] section.
[16 Oct 2008 13:24] Marques Johansson
My original description is bogus.  What I said in comment #1 is what should have been my original description. I misread the docs when reporting this as a bug - I would like to see it as a new feature.
[16 Mar 2009 2:09] Samuel Huckins
Running 5.0.67 on Ubuntu 8.10, this is still the case, exactly as originally described. And it's quite annoying, as I need to set a number of modes all at once, every time I log in.
[19 Feb 2010 13:52] Susanne Ebrecht
Verified as described with MySQL 5.1.