Bug #53783 mysql_secure_installation should have usage information
Submitted: 19 May 2010 7:54 Modified: 9 Dec 2016 11:50
Reporter: Daniël van Eeden Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Installing Severity:S3 (Non-critical)
Version:5.1.48, 5.4.4 OS:Any
Assigned to: CPU Architecture:Any
Tags: Contribution, patch, script, usage

[19 May 2010 7:54] Daniël van Eeden
Description:
mysql_secure_installation does have options as show in bug #46842 but does not print usage information when called with the --help option.

How to repeat:
mysql_secure_installation --help

Expected: Usage information

Actual: It ignores the --help

Suggested fix:
--- mysql_secure_installation.sh.orig	2010-05-19 09:39:45.410764000 +0200
+++ mysql_secure_installation.sh	2010-05-19 09:49:14.219991000 +0200
@@ -200,8 +200,20 @@
     rm -f $config $command
 }
 
+usage() {
+    cat <<EOF
+Usage: $0 [OPTIONS]
+  -S, --socket=name   Socket file to use for connection.
+                      Buffer for TCP/IP and socket communication
+EOF
+    exit 1
+}
 
 # The actual script starts here
+if [ $1 = "--help" ]; then
+  usage
+fi
+
 
 prepare
 set_echo_compat
[19 May 2010 8:10] Valeriy Kravchuk
Thank you for the problem report and patch contributed.
[12 Jan 2014 17:39] Daniël van Eeden
This bug is fixed in MySQL 5.7
[10 Nov 2016 22:09] Oli Sennhauser
Not if my MySQL 5.7.16:

shell> mysql_secure_installation --help

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.
The 'validate_password' plugin is installed on the server.
The subsequent steps will run with the existing configuration
of the plugin.
Please set the password for root here.

New password: 
...
[9 Dec 2016 11:50] Terje Røsten
Posted by developer:
 
Fixed by:

commit 2fb9344d2ab546402705e8d7203616d7487f5e35
Author: Vamsikrishna Bhagi <vamsikrishna.bhagi@oracle.com>
Date:   Tue Aug 13 21:47:28 2013 +0530

    WL#6441 Convert mysql_secure_installation script to C