Bug #79305 mysql_secure_installation isn't working with prompt in the [mysql] group
Submitted: 17 Nov 2015 7:29 Modified: 11 Jan 2016 13:59
Reporter: Lukas Ogris Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.7.9, for linux-glibc2.5 (x86_64) OS:Linux (linux)
Assigned to: CPU Architecture:Any
Tags: [mysql], 5.7.9, mysql_secure_installation, prompt

[17 Nov 2015 7:29] Lukas Ogris
Description:
Since MySQL 5.7.9 mysql_secure_installation isn't working if there is a prompt setting in the [mysql] group of the configuration file. 

How to repeat:
Just add 
[mysql]
prompt="\u@\h:\d>

to your configuration file and execute 
mysql_secure_installation
[19 Nov 2015 15:01] MySQL Verification Team
Thank you for the bug report. What you meant isn't working?. I got only an error message about the variable prompt but the secure process worked:

c:\tmp\mysql-5.7.9-winx64>bin\mysql_secure_installation --defaults-file=c:\tmp\my.ini
mysql_secure_installation: [ERROR] unknown variable 'prompt=\u@\h:\d>'

Securing the MySQL server deployment.

Enter password for user root: ************

The existing password for the user account root has expired. Please set a new password.

New password: ******

Re-enter new 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: No
Using existing password for root.
Change the password for root ? ((Press y|Y for Yes, any other key for No) : y

New password: ******

Re-enter new password: ******
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : no

 ... skipping.

Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : no

 ... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : no

 ... skipping.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done!
[23 Nov 2015 7:42] Lukas Ogris
Thank you for your reply.

UPDATE:
MySQL_secure_installation is using the default configuration file once there is a problem in the personal one.

In my case I'm not using the default configuration file. I've added the prompt option in my personal one.

If I run mysql_secure_installation --defaults-file=<path_to_personal_my.cnf>
the tool is using the parameter (e.g. socket) out of the default my.cnf and therefore it is not working in my case.

mysql_secure_installation: [ERROR] unknown variable 'prompt="\u@\h:\d>'

Securing the MySQL server deployment.

Enter password for user root:
Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

If I run mysql_secure_installation --defaults--file=<path_to_personal_my.cnf>
without the prompt option the tool is using the parameter out of my personal configuration file and everything is working:

$ ./mysql_secure_installation --defaults-file=./my.cnf

Securing the MySQL server deployment.

Enter password for user root:

The existing password for the user account root has expired. Please set a new password.

New password:

Re-enter new 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: 0
Using existing password for root.

Estimated strength of the password: 100
Change the password for root ? ((Press y|Y for Yes, any other key for No) : n

 ... skipping.
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.

Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done!
[25 Nov 2015 16:43] MySQL Verification Team
Thank you for the feedback. Then there isn't issue?. Thanks.
[26 Dec 2015 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".