Uploaded image for project: 'Moodle Community Sites'
  1. Moodle Community Sites
  2. MDLSITE-7922

Incorrect Default `datadir` in `my.ini` Causes MySQL Startup Failure in Windows Moodle Installer

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Low Low
    • download.moodle.org
    • None

      The Windows installer for Moodle (specifically tested with version 4.5.1+ from the MoodleWindowsInstaller-latest-405 package, but may affect other versions) contains an incorrect default datadir setting in the my.ini file located at server/mysql/data/my.ini. This misconfiguration prevents MySQL from starting correctly, leading to a failed Moodle installation.

      Problem

      The default my.ini file included with the installer contains the following setting under the [mysqld] section:

      [mysqld]
      datadir=c:/xampp/mysql/data

      This path is likely a generic placeholder and does not reflect the actual data directory used by the Moodle-XAMPP installation. The path appears to be relative to an assumed XAMPP installation directory, which may not be valid for all users, especially if they choose a custom installation path.

      Due to the incorrect datadir, MySQL fails to initialize the InnoDB storage engine and returns an error: Can't find mysql\data\mysql.pid.

      Expected Behavior

      The my.ini file should either:

      1. Use a correct, dynamically generated absolute path for datadir that reflects the user's chosen installation directory.
      1. Use a path relative to the MySQL base directory, ensuring portability.

      Temporary Workaround

      Users can manually correct the datadir setting in my.ini by replacing the default value with the absolute path to the actual MySQL data directory within their Moodle installation. For instance:

       

      [mysqld]
      datadir=<Moodle_Installation_Root>/server/mysql/data 

      Where <Moodle_Installation_Root> should be replaced with the actual root directory of the Moodle installation.

       

      Possible Solution

      The Moodle Windows installer should be updated to generate the my.ini file with a correct datadir setting, either by using an absolute path based on the user's installation directory or a path relative to a well-defined base directory within the Moodle installation.

            jpataleta Jun Pataleta
            suhassp Suhas S P
            Jun Pataleta Jun Pataleta
            Votes:
            1 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 19 minutes
                19m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.