Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-50633

Error Install Moodle 2.x on MySql 5.7.x

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.6.8, 2.7.4, 2.8.2, 2.9
    • Fix Version/s: 2.8.9, 2.9.3
    • Component/s: Installation
    • Labels:
    • Testing Instructions:
      Hide

      Install moodle on mysql 5.6 and 5.7 and make sure there are no errors in either case.

      There was a mistake in the sql for 5.6, I think you just pasted in the wrong location, I changed it.

      Show
      Install moodle on mysql 5.6 and 5.7 and make sure there are no errors in either case. There was a mistake in the sql for 5.6, I think you just pasted in the wrong location, I changed it.
    • Affected Branches:
      MOODLE_26_STABLE, MOODLE_27_STABLE, MOODLE_28_STABLE, MOODLE_29_STABLE
    • Fixed Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE
    • Pull Master Branch:
      wip-MDL-50633-master2

      Description

      When try to install Moodle 2.x or superior, Using MySql 5.7.5 or superior you get an error:

      ----------------
      Debug info: Unknown system variable 'storage_engine'
      SELECT @@storage_engine
      [NULL]
      Error code: dmlreadexception
      --------------

      The error happen because moodle try to read the DataBase engine using a variable not present on MySql 5.7.5 or superior.

      Solution:

      From: ./lib/dml/mysqli_native_moodle_database.php
      On section:

         // get the default database engine
              $sql = "SELECT @@storage_engine";
              $this->query_start($sql, NULL, SQL_QUERY_AUX);
              $result = $this->mysqli->query($sql);
              $this->query_end($result);
              if ($rec = $result->fetch_assoc()) {
                  $engine = $rec['@@storage_engine'];
              }
              $result->close();
       
              if ($engine === 'MyISAM') {
                  // we really do not want MyISAM for Moodle, InnoDB or XtraDB is a reasonable defaults if supported
                  $sql = "SHOW STORAGE ENGINES";
                  $this->query_start($sql, NULL, SQL_QUERY_AUX);
                  $result = $this->mysqli->query($sql);
                  $this->query_end($result);
                  $engines = array();
                  while ($res = $result->fetch_assoc()) {
                      if ($res['Support'] === 'YES' or $res['Support'] === 'DEFAULT') {
                          $engines[$res['Engine']] = true;
                      }
                  }
                  $result->close();
                  if (isset($engines['InnoDB'])) {
                      $engine = 'InnoDB';
                  }
                  if (isset($engines['XtraDB'])) {
                      $engine = 'XtraDB';
                  }
              }  
      

      -----------
      Change the select for:
      SELECT @@default_storage_engine
      ----------------

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  1 Vote for this issue
                  Watchers:
                  7 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    9/Nov/15