Bug #83779 mysql_secure_installation does not consider Ctrl-C / ^C keyboard sequence
Submitted: 10 Nov 2016 22:23 Modified: 14 Nov 2016 7:00
Reporter: Oli Sennhauser Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.7.16 OS:Linux
Assigned to: CPU Architecture:Any
Tags: Abort, mysql_secure_installation

[10 Nov 2016 22:23] Oli Sennhauser
Description:
mysql_secure_installation does not abort on the typical keyboard sequence Ctrl-C / ^C to abort a process. Or at least it takes serious effort to abort the process...

This is pretty nasty especially if mysql_secure_installation does not consider options like --help

This did work properly in the 5.6 shell version.

How to repeat:
/home/mysql/product/mysql-5.7.16/bin/mysql_secure_installation --socket=/tmp/mysql.sock --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: 

Re-enter new password: 
Sorry, passwords do not match.

New password: 

Re-enter new password: 

Estimated strength of the password: 0 
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : ^C

Suggested fix:
The long requested feature of --help should work.

^C should work always and immediately!
[10 Nov 2016 22:33] Oli Sennhauser
Without having any clue: Is SIGRT the right thing to do here...?
[11 Nov 2016 7:15] Umesh Shastry
Hello Oli,

Thank you for the bug report.
Could you please provide the exact MySQL Server Build/OS details etc as I had no issues on Win7/OL7(MySQL installed using unzip/binary tarball builds)/Ubuntu16.04LTS(MySQL installed using Apt repo) with Control-C and it instantly aborted? 

Thanks,
Umesh
[13 Nov 2016 20:04] Oli Sennhauser
Hello Umesh

Ctrl-C does not work on the password prompt for example:

shell> mysql_secure_installation --user=root

Securing the MySQL server deployment.

Enter password for user root: <- Here it does NOT work!

I am using Generic binary Tar balls. For example this:
mysql-5.7.15-linux-glibc2.5-x86_64

Regards,
Oli
[14 Nov 2016 7:00] Umesh Shastry
Thank you Oli.
Confirmed that Ctrl-C does not work on the password prompt.

.
Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?

Press y|Y for Yes, any other key for No: Y

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2
Please set the password for root here.

New password:

^^ Try here Ctrl-C

Regards,
Umesh