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

mysql_upgrade.exe error when mysql is migrated to mariadb

Details

    • 5.5.48-0

    Description

      Hi,

      im migrating from mysql(5.1.73 64-bit) to mariadb 5.5.43 64-bit:
      1. delete mysql/bin, mysql/share
      2. unzip mariadb
      3. update my.ini file
      4. start MariaDB service
      5. run mysql_upgrade.exe -u user -ppassword --port 3306 -f --upgrade-system-tables
      and at this point i got the following error:

      FATAL ERROR: Upgrade failed

      The --upgrade-system-tables option was used, databases won't be touched.
      Phase 1/4: Fixing views from mysql
      MySQL upgrade detected
      '""' is not recognized as an internal or external command,
      operable program or batch file.

      The migration has always worked. It has been not working since version 5.5.43.

      Attachments

        Activity

          elenst Elena Stepanova added a comment - - edited

          Thanks for the report.
          Reproducible on Linux also, only on 5.5, 10.0 looks fine.

          The empty command is the path to mysqlcheck, which is needed but not set due to the combination of conditions (--upgrade-system-tables + MySQL directory).

          The easy way to fix it seems to be this (although there might be better ways):

          diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
          index 0be8f91..afcc415 100644
          --- a/client/mysql_upgrade.c
          +++ b/client/mysql_upgrade.c
          @@ -1051,16 +1051,11 @@ int main(int argc, char **argv)
             /* Find mysql */
             find_tool(mysql_path, IF_WIN("mysql.exe", "mysql"), self_name);
           
          -  if (!opt_systables_only)
          -  {
          -    /* Find mysqlcheck */
          -    find_tool(mysqlcheck_path, IF_WIN("mysqlcheck.exe", "mysqlcheck"), self_name);
          -  }
          -  else
          -  {
          -    if (!opt_silent)
          -      printf("The --upgrade-system-tables option was used, databases won't be touched.\n");
          -  }
          +  /* Find mysqlcheck */
          +  find_tool(mysqlcheck_path, IF_WIN("mysqlcheck.exe", "mysqlcheck"), self_name);
          +
          +  if (opt_systables_only && !opt_silent)
          +    printf("The --upgrade-system-tables option was used, databases won't be touched.\n");
           
             /*
               Read the mysql_upgrade_info file to check if mysql_upgrade

          On 10.0 the condition is already gone, that's why it works.

          Change to the test case:

          diff --git a/mysql-test/t/mysql_upgrade_view.test b/mysql-test/t/mysql_upgrade_view.test
          index 7a098aa..fbeea48 100644
          --- a/mysql-test/t/mysql_upgrade_view.test
          +++ b/mysql-test/t/mysql_upgrade_view.test
          @@ -157,5 +157,29 @@ rename table mysql.ev_bk to mysql.event;
           
           drop table if exists kv;
           drop view v1,v2,v3,v4;
          +
          +# MDEV-9453 mysql_upgrade.exe error when mysql is migrated to mariadb
          +# (mysql_upgrade.exe --upgrade-system-tables fails on fixing views)
          +
          +# Make it look like a MySQL directory again
          +
          +rename table mysql.event to mysql.ev_bk;
          +--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/event.MYI $MYSQLD_DATADIR/mysql/event.MYI
          +--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/event.MYD $MYSQLD_DATADIR/mysql/event.MYD
          +--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/event.frm $MYSQLD_DATADIR/mysql/event.frm
          +
          +--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v1.frm $MYSQLD_DATADIR/test/v1.frm
          +--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v2.frm $MYSQLD_DATADIR/test/v2.frm
          +--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v3.frm $MYSQLD_DATADIR/test/v3.frm
          +
          +flush tables;
          +
          +--replace_result $MYSQLTEST_VARDIR var
          +--exec $MYSQL_UPGRADE --force --upgrade-system-tables 2>&1
          +
          +# back to mariadb default
          +drop table mysql.event;
          +rename table mysql.ev_bk to mysql.event;
          +drop view v1,v2,v3;
           drop table t1;

          elenst Elena Stepanova added a comment - - edited Thanks for the report. Reproducible on Linux also, only on 5.5, 10.0 looks fine. The empty command is the path to mysqlcheck, which is needed but not set due to the combination of conditions (--upgrade-system-tables + MySQL directory). The easy way to fix it seems to be this (although there might be better ways): diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 0be8f91..afcc415 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -1051,16 +1051,11 @@ int main(int argc, char **argv) /* Find mysql */ find_tool(mysql_path, IF_WIN("mysql.exe", "mysql"), self_name); - if (!opt_systables_only) - { - /* Find mysqlcheck */ - find_tool(mysqlcheck_path, IF_WIN("mysqlcheck.exe", "mysqlcheck"), self_name); - } - else - { - if (!opt_silent) - printf("The --upgrade-system-tables option was used, databases won't be touched.\n"); - } + /* Find mysqlcheck */ + find_tool(mysqlcheck_path, IF_WIN("mysqlcheck.exe", "mysqlcheck"), self_name); + + if (opt_systables_only && !opt_silent) + printf("The --upgrade-system-tables option was used, databases won't be touched.\n"); /* Read the mysql_upgrade_info file to check if mysql_upgrade On 10.0 the condition is already gone, that's why it works. Change to the test case: diff --git a/mysql-test/t/mysql_upgrade_view.test b/mysql-test/t/mysql_upgrade_view.test index 7a098aa..fbeea48 100644 --- a/mysql-test/t/mysql_upgrade_view.test +++ b/mysql-test/t/mysql_upgrade_view.test @@ -157,5 +157,29 @@ rename table mysql.ev_bk to mysql.event; drop table if exists kv; drop view v1,v2,v3,v4; + +# MDEV-9453 mysql_upgrade.exe error when mysql is migrated to mariadb +# (mysql_upgrade.exe --upgrade-system-tables fails on fixing views) + +# Make it look like a MySQL directory again + +rename table mysql.event to mysql.ev_bk; +--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/event.MYI $MYSQLD_DATADIR/mysql/event.MYI +--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/event.MYD $MYSQLD_DATADIR/mysql/event.MYD +--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/event.frm $MYSQLD_DATADIR/mysql/event.frm + +--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v1.frm $MYSQLD_DATADIR/test/v1.frm +--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v2.frm $MYSQLD_DATADIR/test/v2.frm +--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v3.frm $MYSQLD_DATADIR/test/v3.frm + +flush tables; + +--replace_result $MYSQLTEST_VARDIR var +--exec $MYSQL_UPGRADE --force --upgrade-system-tables 2>&1 + +# back to mariadb default +drop table mysql.event; +rename table mysql.ev_bk to mysql.event; +drop view v1,v2,v3; drop table t1;

          People

            serg Sergei Golubchik
            eidbadr Eid Badr
            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.