Bug #44355 Need system variable for --bind-address option
Submitted: 18 Apr 2009 17:00 Modified: 24 Jan 2011 13:23
Reporter: John David Duncan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:5.1, 6.0 OS:Any
Assigned to: Georgi Kodinov CPU Architecture:Any
Tags: Agent, Contribution, variables

[18 Apr 2009 17:00] John David Duncan
Description:
It is possible to start mysqld with the --bind-address option.  This option is sometimes used to start many mysqld servers on the same machine, each listening on port 3306 but all on separate IP addresses.  Unfortunately when this is done, the server does not provide any way for the MySQL Enterprise Monitor (or other management tools) to distinguish among the various mysqld instances on the machine. The bind-address should be exposed as a global variable (in the way that "port" and "socket" are already exposed), in order to distinctly identify the various server instances.  

How to repeat:
Start mysqld with "--bind-address=127.0.0.1"
SHOW VARIABLES LIKE "bind%";   [empty result set] 

Suggested fix:
Here is a patch (actually only four lines of changes) that will expose the --bind-address option as the system global variable "bind_address".

--- mysql_priv.h.orig	2009-03-13 14:53:16.000000000 -0700
+++ mysql_priv.h	2009-04-18 09:41:48.000000000 -0700
@@ -1890,6 +1890,7 @@
 #endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
 #ifdef MYSQL_SERVER
 extern char glob_hostname[FN_REFLEN], mysql_home[FN_REFLEN];
+extern char *my_bind_addr_str;
 extern char pidfile_name[FN_REFLEN], system_time_zone[30], *opt_init_file;
 extern char log_error_file[FN_REFLEN], *opt_tc_log_file;
 extern ulonglong log_10_int[20];

--- mysqld.cc.orig	2009-03-13 14:53:16.000000000 -0700
+++ mysqld.cc	2009-04-18 09:41:43.000000000 -0700
@@ -369,7 +369,6 @@
 static char *default_character_set_name;
 static char *character_set_filesystem_name;
 static char *lc_time_names_name;
-static char *my_bind_addr_str;
 static char *default_collation_name; 
 static char *default_storage_engine_str;
 static char compiled_default_collation_name[]= MYSQL_DEFAULT_COLLATION_NAME;
@@ -539,6 +538,7 @@
 char mysql_data_home_buff[2], *mysql_data_home=mysql_real_data_home;
 char server_version[SERVER_VERSION_LENGTH];
 char *mysqld_unix_port, *opt_mysql_tmpdir;
+char *my_bind_addr_str;
 const char **errmesg;			/**< Error messages */
 const char *myisam_recover_options_str="OFF";
 const char *myisam_stats_method_str="nulls_unequal";

--- set_var.cc.orig	2009-03-13 14:53:18.000000000 -0700
+++ set_var.cc	2009-04-18 09:41:36.000000000 -0700
@@ -176,6 +176,7 @@
                                              OPT_GLOBAL, SHOW_LONG,
                                              (uchar*) &back_log);
 static sys_var_const_os_str       sys_basedir(&vars, "basedir", mysql_home);
+static sys_var_const_os_str_ptr   sys_bind_addr(&vars, "bind_address", &my_bind_addr_str);
 static sys_var_long_ptr	sys_binlog_cache_size(&vars, "binlog_cache_size",
 					      &binlog_cache_size);
 static sys_var_thd_binlog_format sys_binlog_format(&vars, "binlog_format",
[18 Apr 2009 18:47] John David Duncan
mysql-test-run.pl on 5.1.33 + this patch:  "All 715 tests were successful" on Mac laptop.
[28 Oct 2010 19:26] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/122246

3341 Georgi Kodinov	2010-10-28
      Bug #44355: Need system variable for --bind-address option
      
      Added a system variable for the bind_address command line
      option.
[1 Nov 2010 16:45] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/122455

3350 Georgi Kodinov	2010-10-28
      Bug #44355: Need system variable for --bind-address option
      
      Added a system variable for the bind_address command line
      option.
[1 Nov 2010 17:39] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/122463

3351 Georgi Kodinov	2010-10-28
      Bug #44355: Need system variable for --bind-address option
      
      Added a system variable for the bind_address command line
      option.
[13 Nov 2010 16:21] Bugs System
Pushed into mysql-trunk 5.6.99-m5 (revid:alexander.nozdrin@oracle.com-20101113155825-czmva9kg4n31anmu) (version source revid:alexander.nozdrin@oracle.com-20101113155825-czmva9kg4n31anmu) (merge vers: 5.6.99-m5) (pib:21)
[13 Nov 2010 16:28] Bugs System
Pushed into mysql-next-mr (revid:alexander.nozdrin@oracle.com-20101113160336-atmtmfb3mzm4pz4i) (version source revid:alexander.nozdrin@oracle.com-20101113152540-gxro4g0v29l27f5x) (pib:21)
[20 Dec 2010 3:00] Paul DuBois
Noted in 5.6.1 changelog.

The is now a bind_address system variable containing the value of the
--bind-address option. This enables the address to be accessed at
runtime.