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

mysql_secure_installation can't find "mysql" in basedir

    XMLWordPrintable

Details

    • 10.0.22

    Description

      If the "mysql" client is not found in $PATH, then mysql_secure_installation won't find it from in basedir:

      [gmontee@localhost mariadb-10.1.5-linux-x86_64]$ ./bin/mysql_secure_installation -u root --basedir=/tmp/mariadb-10.1.5-linux-x86_64/
      print: /tmp/mariadb-10.1.5-linux-x86_64//bin/my_print_defaults
       
      FATAL ERROR: Could not find mysql
       
      The following directories were searched:
       
      /tmp/mariadb-10.1.5-linux-x86_64//bin
       
      If you compiled from source, you need to run 'make install' to
      copy the software into the correct location ready for operation.
       
      If you are using a binary release, you must either be at the top
      level of the extracted archive, or pass the --basedir option
      pointing to that location.

      But it will find it if added to $PATH:

      [gmontee@localhost mariadb-10.1.5-linux-x86_64]$ export PATH=$PATH:/tmp/mariadb-10.1.5-linux-x86_64/bin
      [gmontee@localhost mariadb-10.1.5-linux-x86_64]$ ./bin/mysql_secure_installation -u root --basedir=/tmp/mariadb-10.1.5-linux-x86_64/
      print: /tmp/mariadb-10.1.5-linux-x86_64//bin/my_print_defaults
       
      NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
       
      In order to log into MariaDB to secure it, we'll need the current
      password for the root user. If you've just installed MariaDB, and
      you haven't set the root password yet, the password will be blank,
      so you should just press enter here.
       
      Enter current password for root (enter for none):

      I think the bug happens because bindir is set to use basedir here: https://github.com/MariaDB/server/blob/d258f5ff0435cbd8b000226dc7dc3ec4e9b79cbc/scripts/mysql_secure_installation.sh#L176

      But then find_in_basedir is called here: https://github.com/MariaDB/server/blob/d258f5ff0435cbd8b000226dc7dc3ec4e9b79cbc/scripts/mysql_secure_installation.sh#L184

      Which adds basedir to the path again here: https://github.com/MariaDB/server/blob/d258f5ff0435cbd8b000226dc7dc3ec4e9b79cbc/scripts/mysql_secure_installation.sh#L83

      So if basedir is /usr/local/mysql, it will search for /usr/local/mysql/usr/local/mysql/bin/mysql.

      Attachments

        Issue Links

          Activity

            People

              svoj Sergey Vojtovich
              GeoffMontee Geoff Montee (Inactive)
              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.