Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-5378

mysql init script sets a wrong default value for datadir

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 5.5.34, 10.0.6
    • Fix Version/s: 5.5.37, 10.0.9
    • Component/s: None
    • Labels:
    • Environment:
      RPM-based (e.g. Fedora 18/20)

      Description

      Courtesy of Philip orleans.

      /etc/init.d/mysql script, among other smart logic, attempts to deduce the location of the datadir and the pidfile and passes them to mysqld_safe script.

      By default, my.cnf file installed with the packages is empty, it does not have either basedir or datadir. So, /etc/init.d/mysql uses defaults: basedir=/usr, datadir=/var/lib/mysql, pidfile=$datadir/<name>.pid. All is good.

      If one sets a non-default datadir in my.cnf, the script picks it up and adjusts the paths for datadir and pidfile accordingly. All is still good.

      The problem starts when one sets a basedir explicitly in the cnf file (even if it's the same /usr), but does not set any datadir. In this case /etc/init.d/mysql deduces that the basedir was set to something, while datadir was not, and in an attempt to be smart it sets the datadir to $basedir/data rather than the default-default /var/lib/mysql. So, it ends up with datadir=/usr/data and pid_file=/usr/data/fedora20.pid. Since /usr/data does not exist, the pid file cannot be created, and the whole thing fails.

      I think it's an unnecessary complication, deb packages are doing just fine without it. However, the changes should be careful since whatever weird logic the scripts have, somebody already relies on it.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              serg Sergei Golubchik added a comment -

              I'm not going to fix that. The comment in the mysql script explicitly says

              # If you change base dir, you must also change datadir.
              

              Changing this behavior intentional may adversely affect users that rely on it.

              If you think it's worth doing, I can add a warning for this case — when basedir is set, datadir is not, and it's automatically gets the value of $basedir/data

              Show
              serg Sergei Golubchik added a comment - I'm not going to fix that. The comment in the mysql script explicitly says # If you change base dir, you must also change datadir. Changing this behavior intentional may adversely affect users that rely on it. If you think it's worth doing, I can add a warning for this case — when basedir is set, datadir is not, and it's automatically gets the value of $basedir/data

                People

                • Assignee:
                  serg Sergei Golubchik
                  Reporter:
                  elenst Elena Stepanova
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Due:
                    Created:
                    Updated:
                    Resolved: