Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # OK, I want to set the sql_mode variable for my session upon connection.
- # It's easy to do manually:
- mysql> set sql_mode='STRICT_ALL_TABLES';
- Query OK, 0 rows affected (0.00 sec)
- # I don't want to type that every time, though; I want to alias 'mysql' to automatically set it.
- [dave@rasputin:~]$ mysql --help | grep -i var
- -O, --set-variable=name
- Change the value of a variable. Please note that this
- option is deprecated; you can set variables directly with
- --variable-name=value.
- # Ah, OK, so --sql_mode=STRICT_ALL_TABLES then, that's easy...
- [dave@rasputin:~]$ mysql --sql_mode=STRICT_ALL_TABLES
- mysql: unknown variable 'sql_mode=STRICT_ALL_TABLES'
- # Sorry, what?
- # Let's try --set-variable, even though it's deprecated...
- [dave@rasputin:~]$ mysql --set-variable=sql_mode=STRICT_ALL_TABLES
- mysql: unknown variable 'sql_mode=STRICT_ALL_TABLES'
- [dave@rasputin:~]$ mysql --set-variable=sql_mode STRICT_ALL_TABLES
- mysql: unknown variable 'sql_mode'
- # Maybe it needs to be sql-mode, when passed as an option
- [dave@rasputin:~]$ mysql --sql-mode=STRICT_ALL_TABLES
- mysql: unknown variable 'sql-mode=STRICT_ALL_TABLES'
- # OK, it doesn't seem to work.
- # Maybe if I put it in ~/.my.cnf (I don't really want to do it that way, I want it done via
- # an alias in my .profile which is replicated to all boxes I use, but let's try anyway):
- [dave@rasputin:~]$ grep sql_mode .my.cnf
- sql_mode=STRICT_ALL_TABLES
- [dave@rasputin:~]$ mysql
- mysql: unknown variable 'sql_mode=STRICT_ALL_TABLES'
- # I'm lost.
- # Versions:
- [dave@rasputin:~]$ mysql -V
- mysql Ver 14.12 Distrib 5.0.51a, for debian-linux-gnu (x86_64) using readline 5.2
- [dave@rasputin:~]$ mysql -e 'select version()'
- +-----------------------+
- | version() |
- +-----------------------+
- | 5.0.51a-24+lenny4-log |
- +-----------------------+
Add Comment
Please, Sign In to add comment