• Timothy Smith's avatar
    Bug#35106: mysql_secure_installation fails on Windows, missing "use · 61973d67
    Timothy Smith authored
    Term::ReadKey"
    
    Add the missing module import.  Also, while here, fix a few glaring problems
    with the script, and ensure that it behaves properly.  It seems this script
    may have never been working correctly (e.g., reading password didn't chomp()
    the result, so password was set with \n at the end; comparing the re-typed
    password to original was done with inverted test).
    
    Add END { cleanup(); } block to ensure the script removes temporary working
    files.
    
    Add SIG{INT} / SIG{QUIT} handler.
    
    Do a bit of reorganization to make the code easier to understand.
    
    Limit failed connection attempts to 3.
    
    Use ./bin/mysql if it exists, and then fall back on mysql in PATH (before it
    assumed 'mysql' in the path).  Print a nicer error if 'mysql' can't be called.
    
    This has been tested on Windows (ActivePerl from cmd.exe, no cygwin needed)
    and Linux.
    61973d67
mysql_secure_installation.pl.in 7.82 KB