Bug #49356 mysqld_multi does not interpret !include and !includedir in opt. file
Submitted: 2 Dec 2009 15:55 Modified: 25 Jan 2012 16:18
Reporter: Jordi Clariana Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.1.40, 5,1,41 OS:Solaris (SunOS solaris10 5.10 Generic_141444-09 sun4v sparc SUNW,SPARC-Enterprise-T5220 Solaris)
Assigned to: CPU Architecture:Any
Tags: include, includedir, my_print_defaults, my.cnf, mysqld_multi, options file
Triage: Triaged: D2 (Serious)

[2 Dec 2009 15:55] Jordi Clariana
Description:
Hello,

While I was trying to configure my server for multiple instances (using mysqld_multi), I realized that I was not able to use the !include and !includedir options because mysqld_multi uses my_print_defaults which doesn't interpet these options.

In my opinion my_print_defaults should interpret !include and !include_dir options because in a mysqld_multi environment you can use a file per instance which will make easyest to manage in some automatic or semiatomatic way the instances you have. Otherwise you have to have a monolitic my.cnf file with all instances configured there.

Regards,
Jordi Clariana

How to repeat:
Create a /etc/my.cnf file with this line:

!include /etc/my2.cnf

Then, create the /etc/my2.cnf with these two lines:

[mysqld]
socket=/tmp/mysqld.sock

Execute:
my_print_defaults --defaults-file=/etc/my.cnf mysqld

It returns nothing.

In the other hand, this command:
my_print_defaults --defaults-file=/etc/my2.cnf mysqld

returns:
--socket=/tmp/mysqld.sock

Suggested fix:
Make my_print_defaults interpret !include and !includedir options.
[3 Dec 2009 7:10] Valeriy Kravchuk
Are you sure that you problem weas related to !include handling? Look, this is what I have with 5.1.42:

openxs@suse:/home2/openxs/dbs/5.1> cat my.cnf
!include my2.cnf
openxs@suse:/home2/openxs/dbs/5.1> cat my2.cnf
[client]
port=9999
openxs@suse:/home2/openxs/dbs/5.1> bin/my_print_defaults --defaults-file=`pwd`/my.cnf client
--port=9999
[3 Dec 2009 8:03] Jordi Clariana
I have to apologize. Is not a my_print_defaults problem. Is a mysqld_multi problem. It uses my_print_defaults in order to launch mysql instances, but does not seems to follow the !include[dir].

Example:

# my.cnf file
## START ##
[mysqld_multi]
mysqld     = /opt/mysql/bin/mysqld_safe
mysqladmin = /opt/mysql/bin/mysqladmin 

[mysql]
prompt=MYSQL(\\u@\\h) [\\d]>\\_
character-sets-dir=/usr/share/mysql/charsets
default-character-set=latin1                

[mysqladmin]
character-sets-dir=/usr/share/mysql/charsets
default-character-set=latin1                

[mysqld]
#Defaults
character-set-server            = latin1
default-character-set           = latin1
user                            = mysql 
port                            = 3306  

!includedir /tmp/confs
## END ##

# /tmp/confs/a.cnf file
## START ##
[mysqld1]
bind-address = 192.168.1.1

pid-file = /mysqlpool/instance1/mysqld/mysqld.pid
socket = /mysqlpool/instance1/mysqld/mysqld.sock
datadir = /mysqlpool/instance1/mysql-data
## END ##

# /tmp/confs/b.cnf file
## START ##
[mysqld2]
bind-address = 192.168.1.2

pid-file = /mysqlpool/instance2/mysqld/mysqld.pid
socket = /mysqlpool/instance2/mysqld/mysqld.sock
datadir = /mysqlpool/instance2/mysql-data
## END##

Then I run:
# mysqld_multi --defaults-file=/tmp/my.cnf report
Reporting MySQL servers
No groups to be reported (check your GNRs)

If I write my.cnf, a.cnf and b.cnf in just one file:
# mysqld_multi --defaults-file=/tmp/my.cnf report
Reporting MySQL servers
MySQL server from group: mysqld1 is running
MySQL server from group: mysqld2 is running

Maybe I have to open a new issue?
Thanks.

Jordi Clariana
[3 Dec 2009 8:21] Valeriy Kravchuk
Now I can verify this:

openxs@suse:/home2/openxs/dbs/5.1> cat my.cnf
!include my2.cnf
openxs@suse:/home2/openxs/dbs/5.1> cat my2.cnf
[client]
port=9999

[mysqld1]
port=3307

[mysqld2]
port=3308
openxs@suse:/home2/openxs/dbs/5.1> bin/mysqld_multi --defaults-file=`pwd`/my2.cnf report
Reporting MySQL servers
MySQL server from group: mysqld1 is not running
MySQL server from group: mysqld2 is not running
openxs@suse:/home2/openxs/dbs/5.1> bin/mysqld_multi --defaults-file=`pwd`/my.cnf report
Reporting MySQL servers
No groups to be reported (check your GNRs)

I think this is a bug actually.
[3 Dec 2009 8:34] Jordi Clariana
I add "mysqld_multi" to the tags.
[25 Jan 2012 16:11] Mathieu Parent
This one and #29327 are duplicates
[25 Jan 2012 16:18] Valeriy Kravchuk
Duplicate of bug #29327.