Bug #90801 mysqld_multi unable to get configurations of datadir as defined in /etc/my.cnf
Submitted: 9 May 2018 8:40 Modified: 6 Nov 2018 19:10
Reporter: jian cao Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Installing Severity:S3 (Non-critical)
Version:8.0.11 OS:Red Hat (Red Hat Enterprise Linux Server release 6.6 (Santiago))
Assigned to: CPU Architecture:x86

[9 May 2018 8:40] jian cao
Description:
my.cnf:
[mysqld1]
datadir=/oradata/mysql
socket=/oradata/mysql/mysql.sock
user=mysql
symbolic-links=0
default_authentication_plugin=mysql_native_password
log_error=/oradata/mysql/error.log
max_connections = 1000

start  mysql:
mysqld_multi --defaults-file=/etc/my.cnf start 1

mysqld_multi boot command lost configureations of datadir:
/usr/local/mysql/bin/mysqld --socket=/oradata/mysql/mysql.sock --user=mysql --symbolic-links=0 --default_authentication_plugin=mysql_native_password --log_error=/oradata/mysql/error.log --max_connections=1000  ===>fail to start

How to repeat:
mysqld_multi=>start_mysqlds()
FROM
sub start_mysqlds()
{
...........
 for ($j = 0, $tmp= ""; defined($options[$j]); $j++)
    {
      if ("--datadir=" eq substr($options[$j], 0, 10)) {
        $datadir = $options[$j];
        $datadir =~ s/\-\-datadir\=//;
        eval { mkpath($datadir) };
        if ($@) {
          print "FATAL ERROR: Cannot create data directory $datadir: $!\n";
          exit(1);
        }
      }
      elsif("--mysqladmin=" eq substr($options[$j], 0, 13))
      {
        # catch this and ignore
      }

TO
sub start_mysqlds()
{
...........
 for ($j = 0, $tmp= ""; defined($options[$j]); $j++)
    {
      if ("--datadir=" eq substr($options[$j], 0, 10)) {
        $datadir = $options[$j];
        $datadir =~ s/\-\-datadir\=//;
        eval { mkpath($datadir) };
        if ($@) {
          print "FATAL ERROR: Cannot create data directory $datadir: $!\n";
          exit(1);
        }
      }
      if("--mysqladmin=" eq substr($options[$j], 0, 13))
      {
        # catch this and ignore
      }
[11 Oct 2018 15:08] Sinisa Milivojevic
Hi,

Thank you for your report. However, I fail to see how this could be a bug.

First of all, mysqld_multi script is supposed to point to different configuration file for every single instance. I do not see this done in your case. Hence, you are not using this script as it was designed.

This script is not designed to be change in order to accommodate any changes, like scripting.  If you have your own scripting, then it is your bug. The way that things are setup, each instance will use values from /etc/my.cnf since you do not point each instance to the different configuration file.

Last, but not least, this mysqld_multi is no longer maintained on the operating systems which support systemd daemon, such as Red Hat Linux.
[31 Oct 2018 12:28] Terje Røsten
Please consult documentation:

 https://dev.mysql.com/doc/refman/8.0/en/using-systemd.html

for how to "Configuring Multiple MySQL Instances Using systemd".

There is no need for legacy mysqld_multi script.
[6 Nov 2018 19:10] Paul Dubois
Posted by developer:
 
Fixed in 8.0.14.

mysqld_multi could fail to pass the correct datadir value to mysqld.