Bug #55672 mysql_upgrade dies with internal error
Submitted: 1 Aug 2010 13:09 Modified: 20 Aug 2010 20:08
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.5.5, mysql-trunk OS:Any
Assigned to: Guilhem Bichot CPU Architecture:Any
Tags: regression
Triage: Triaged: D3 (Medium)

[1 Aug 2010 13:09] Shane Bester
Description:
5.5.5 mysql_upgrade dies with internal error.

H:\mysql\5.5\5.5.5\mysql-5.5.5-m3-winx64\bin>mysql_upgrade.exe --no-defaults --ssl
FATAL ERROR: internal error at ..\..\mysql-5.5.5-m3\client\mysql_upgrade.c: 217

5.1.49 gives a different, expected output:

H:\mysql\5.1\5.1.49\mysql-advanced-gpl-5.1.49-win32\bin>mysql_upgrade.exe --no-defaults --ssl
Looking for 'mysql.exe' as: H:\mysql\5.1\5.1.49\mysql-advanced-gpl-5.1.49-win32\bin\mysql.exe
Looking for 'mysqlcheck.exe' as: H:\mysql\5.1\5.1.49\mysql-advanced-gpl-5.1.49-win32\bin\mysqlcheck.exe
Running 'mysqlcheck with default connection arguments
H:\mysql\5.1\5.1.49\mysql-advanced-gpl-5.1.49-win32\bin\mysqlcheck.exe: Got error: 2003: Can't connect to MySQL server on 'localhost' (10061) when trying to connect
FATAL ERROR: Upgrade failed

How to repeat:
on 5.5:
mysql_upgrade --no-defaults --ssl

Suggested fix:
i assume it's a bug, since the error is 'internal' meaning it shouldn't happen.
[1 Aug 2010 13:56] Valeriy Kravchuk
Verified on with current mysql-trunk on Mac OS X:

macbook-pro:trunk openxs$ bin/mysql_upgrade --no-defaults --ssl
FATAL ERROR: internal error at mysql_upgrade.c: 213
macbook-pro:trunk openxs$ cd ../5.1
macbook-pro:5.1 openxs$ bin/mysql_upgrade --no-defaults --ssl
Looking for 'mysql' as: bin/mysql
Looking for 'mysqlcheck' as: bin/mysqlcheck
Running 'mysqlcheck with default connection arguments
bin/mysqlcheck: Got error: 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) when trying to connect
FATAL ERROR: Upgrade failed
[11 Aug 2010 17:57] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/115516

3078 Guilhem Bichot	2010-08-11
      fix for Bug #55672 "mysql_upgrade dies with internal error":
      it couldn't parse the --ssl option.
     @ client/mysql_upgrade.c
        mysql_upgrade parses its options and passes some of them to the underlying
        tools (mysqlcheck etc). To do this passdown, it reconstructs a
        command-line-suitable text from the my_option object (which
        contains the option's name and option's value). For options
        which expect no parameter, it just had to use the option's name;
        for other options, it had to concatenate the option's name,
        a "=" symbol, and the option's value; it had code to handle
        this latter case, but only for GET_STR options (options taking a
        string as value). But since the work on WL 4738, the --ssl
        option, a GET_BOOL, which used to have no parameter (NO_ARG), can
        now have one (OPT_ARG), so with --ssl we came to the "default"
        label, error. Fixed by constructing the command-line-suitable
        representation for GET_BOOL too. For --ssl it will produce
        --ssl=1 ; for --ssl=0, it will produce --ssl=0.
     @ mysql-test/include/mysql_upgrade_preparation.inc
        handles requirements of tests which use mysql_upgrade
     @ mysql-test/r/mysql_upgrade_ssl.result
        result; without the code fix we would get "internal error".
     @ mysql-test/t/mysql_upgrade.test
        This test has requirements before running; moved them
        to an include file in order to share with mysql_upgrade_ssl.
     @ mysql-test/t/mysql_upgrade_ssl.test
        test for bug. Couldn't go into mysql_upgrade.test as this new test requires
        SSL support. --force is needed, in case mysql_upgrade.test run before
        (in which case mysql_upgrade_ssl would say that upgrade has already been
        done); --force forces the upgrade in all cases.
[12 Aug 2010 12:31] Guilhem Bichot
queued to mysql-{5.5,trunk-bugfixing,next-mr-bugfixing}
[16 Aug 2010 6:30] Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@sun.com-20100816062701-qo9dpnk5tkt1pksb) (version source revid:alik@sun.com-20100816062603-xc16eftmv7rmktyq) (merge vers: 5.6.1-m4) (pib:20)
[16 Aug 2010 6:42] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100816062819-bluwgdq8q4xysmlg) (version source revid:alik@sun.com-20100816062612-enatdwnv809iw3s9) (pib:20)
[16 Aug 2010 17:13] Paul Dubois
Noted in 5.6.1 changelog.

mysql_upgrade did not handle the --ssl option properly.

Setting report to Need Merge pending push to 5.5.x.
[17 Aug 2010 5:07] Alexander Nozdrin
It's already in mysql-5.5, version tag: 5.5.6-m3.
[17 Aug 2010 13:36] Paul Dubois
Noted in 5.5.6 changelog.