Bug #27885 | command line clients puke on 'init-command' in my.cnf | ||
---|---|---|---|
Submitted: | 17 Apr 2007 15:13 | Modified: | 5 Dec 2007 18:56 |
Reporter: | Axel Schwenke | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Command-line Clients | Severity: | S3 (Non-critical) |
Version: | 5.0.38 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | Contribution |
[17 Apr 2007 15:13]
Axel Schwenke
[2 May 2007 19:59]
Timothy Smith
It's not immediately obvious how to fix this. Need to ensure that --totally-bogus-option gives a warning *somewhere* (either in the client, or in libmysqlclient).
[20 Feb 2008 19:53]
Omer Barnir
workaround: send the command(s) using an sql script
[3 Jul 2009 1:37]
MySQL Verification Team
I looked at the source code, and I think the problem is: * mysql_real_connect() reads options using mysql_read_default_options() defined in sql-common/client.c, which loads options to struct st_mysql_options using my_load_defaults() defined in mysys/default.c. * libmysqlclient can read init-command option through mysql_real_connect() * in client/mysql.cc, options are loaded to global variables using get_options(), get_one_option() and handle_options(). IMHO, mysql should not call mysql_real_connect() using MYSQL_READ_DEFAULT_FILE option. Instead, it should read init-command separately as it does for other options.
[3 Jul 2009 6:36]
MySQL Verification Team
I've added a sample patch on bug #45634, which mysql CLI parses --init-command option. Kind regards, -- Mikiya