Bug #35106 mysql_secure_installation fails on Windows, missing "use Term::ReadKey"
Submitted: 6 Mar 2008 12:53 Modified: 12 Mar 2010 14:45
Reporter: Philip Stoev Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Installing Severity:S2 (Serious)
Version:5.0.58 OS:Windows
Assigned to: Timothy Smith CPU Architecture:Any

[6 Mar 2008 12:53] Philip Stoev
Description:
The mysql_secure_installation.pl script fails on Windows ,because it tries to call ReadMode() without first loading Term::ReadKey;

How to repeat:
C:\bin\5.0.58\scripts>c:\bin\5.0.58\scripts\mysql_secure_installation.pl

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Undefined subroutine &main::ReadMode called at c:\bin\5.0.58\scripts\mysql_secur
e_installation.pl line 41.

Suggested fix:
Term::ReadKey appears to be part of ActivePerl, so it is all a matter of loading it.
[20 Mar 2008 11:34] Susanne Ebrecht
Verified by looking into the scripts/mysql_secure_installation.pl.in

No ReadKey before ReadMode.
[30 Oct 2009 20:37] 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/88807

2834 Timothy Smith	2009-10-30
      Bug#35106: mysql_secure_installation fails on Windows, missing "use
      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.
[2 Dec 2009 8:04] Bugs System
Pushed into 5.1.42 (revid:joro@sun.com-20091202080033-mndu4sxwx19lz2zs) (version source revid:kristofer.pettersson@sun.com-20091109223504-xvwgsdqiyuve6frt) (merge vers: 5.1.41) (pib:13)
[2 Dec 2009 15:42] MC Brown
A not has been added to the 5.1.42 changelog. 

When running mysql_secure_installation on Windows, the command would fail to load a required module, Term::ReadKey, which was required for correct operation.
[16 Dec 2009 8:46] Bugs System
Pushed into 5.5.0-beta (revid:alik@sun.com-20091216082430-s0gtzibcgkv4pqul) (version source revid:alexey.kopytov@sun.com-20091124081906-6pqi7e7sajimog71) (merge vers: 5.5.0-beta) (pib:14)
[16 Dec 2009 8:52] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20091216083231-rp8ecpnvkkbhtb27) (version source revid:alik@sun.com-20091212203859-fx4rx5uab47wwuzd) (merge vers: 5.6.0-beta) (pib:14)
[17 Dec 2009 10:54] MC Brown
Changelog entry added to 5.5.1
[12 Mar 2010 14:06] Bugs System
Pushed into 5.1.44-ndb-7.0.14 (revid:jonas@mysql.com-20100312135944-t0z8s1da2orvl66x) (version source revid:jonas@mysql.com-20100312115609-woou0te4a6s4ae9y) (merge vers: 5.1.44-ndb-7.0.14) (pib:16)
[12 Mar 2010 14:22] Bugs System
Pushed into 5.1.44-ndb-6.2.19 (revid:jonas@mysql.com-20100312134846-tuqhd9w3tv4xgl3d) (version source revid:jonas@mysql.com-20100312060623-mx6407w2vx76h3by) (merge vers: 5.1.44-ndb-6.2.19) (pib:16)
[12 Mar 2010 14:36] Bugs System
Pushed into 5.1.44-ndb-6.3.33 (revid:jonas@mysql.com-20100312135724-xcw8vw2lu3mijrhn) (version source revid:jonas@mysql.com-20100312103652-snkltsd197l7q2yg) (merge vers: 5.1.44-ndb-6.3.33) (pib:16)
[12 Mar 2010 14:45] MC Brown
No changelog entry required (already noted in earlier changelog)