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

RPM installation not running mysql_install_db if datadir exists

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 5.5.33
    • 5.5.34
    • None
    • None
    • CentOS 6 (haven't looked at the RPM specs for other platforms)

    Description

      The postinstall script of the 5.5.33 CentOS 6 bundle checks to see if the data directory exists, and if not, create it and run mysql_install_db:

        if [ ! -e $datadir ]; then
          # Create data directory
          mkdir -p $datadir/{mysql,test}
       
          # Initiate databases
          /usr/bin/mysql_install_db --rpm --user=mysql
        fi

      This prevents mysql_install_db from running if $datadir exists but is empty. An example of this situation is when $datadir is a separate partition, or perhaps someone wanted to do a fresh install and does "rm -rf /var/lib/mysql/*".

      I believe checking for $datadir/mysql would be a more accurate check, since that must exist or something really bad has happened.

      Thanks,
      -will

      Attachments

        Activity

          wfong Will Fong created issue -
          wfong Will Fong made changes -
          Field Original Value New Value
          Description The postinstall script of the 5.5.33 CentOS 6 bundle checks to see if the data directory exists, and if not, create it and run mysql_install_db:

          {code}
            if [ ! -e $datadir ]; then
              # Create data directory
              mkdir -p $datadir/{mysql,test}

              # Initiate databases
              /usr/bin/mysql_install_db --rpm --user=mysql
            fi
          {code}

          This prevents mysql_install_db from running if $datadir exists but is empty. An example of this situation is when $datadir is a separate partition, or perhaps someone wants to do a fresh install and does "rm -rf /var/lib/mysql/*".

          I believe checking for $datadir/mysql would be a more accurate check, since that must exist or something really bad has happened.

          Thanks,
          -will
          The postinstall script of the 5.5.33 CentOS 6 bundle checks to see if the data directory exists, and if not, create it and run mysql_install_db:

          {code}
            if [ ! -e $datadir ]; then
              # Create data directory
              mkdir -p $datadir/{mysql,test}

              # Initiate databases
              /usr/bin/mysql_install_db --rpm --user=mysql
            fi
          {code}

          This prevents mysql_install_db from running if $datadir exists but is empty. An example of this situation is when $datadir is a separate partition, or perhaps someone wanted to do a fresh install and does "rm -rf /var/lib/mysql/*".

          I believe checking for $datadir/mysql would be a more accurate check, since that must exist or something really bad has happened.

          Thanks,
          -will
          serg Sergei Golubchik made changes -
          Fix Version/s 5.5.34 [ 13500 ]
          serg Sergei Golubchik made changes -
          Assignee Sergei Golubchik [ serg ]

          This is a problem in an environment where a user has mounted some separate device as /var/lib/mysql to serve as the datadir. In that scenario, the directory will exist before the RPM is installed, but it won't contain anything. The script should perhaps look for /var/lib/mysql/mysql or even look for some specific privilege table(s) to determine whether it is necessary to run mysql_install_db.

          kolbe Kolbe Kegel (Inactive) added a comment - This is a problem in an environment where a user has mounted some separate device as /var/lib/mysql to serve as the datadir. In that scenario, the directory will exist before the RPM is installed, but it won't contain anything. The script should perhaps look for /var/lib/mysql/mysql or even look for some specific privilege table(s) to determine whether it is necessary to run mysql_install_db.
          serg Sergei Golubchik made changes -
          Fix Version/s 5.5.34 [ 13700 ]
          Fix Version/s 5.5.33a [ 13500 ]
          serg Sergei Golubchik made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          serg Sergei Golubchik made changes -
          Resolution Fixed [ 1 ]
          Status In Progress [ 3 ] Closed [ 6 ]
          serg Sergei Golubchik made changes -
          Workflow defaullt [ 29017 ] MariaDB v2 [ 43347 ]
          ratzpo Rasmus Johansson (Inactive) made changes -
          Workflow MariaDB v2 [ 43347 ] MariaDB v3 [ 62434 ]
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 62434 ] MariaDB v4 [ 147042 ]

          People

            serg Sergei Golubchik
            wfong Will Fong
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.