Bug #70074 mysql_secure_installation only works within $HOME
Submitted: 18 Aug 2013 16:32 Modified: 26 Aug 2013 8:39
Reporter: Bjoern Boschman (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Installing Severity:S3 (Non-critical)
Version:5.6.13 OS:Linux
Assigned to: CPU Architecture:Any

[18 Aug 2013 16:32] Bjoern Boschman
Description:
it seems that mysql_secure_installation only works while being with current shell within user-homedirectory

How to repeat:
have mysqld isntalled with root password set

change directory to somewhere (/var/tmp)

run mysql_secure_installation and provide correct rooot password

error occurs:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Suggested fix:
sub do_query {} must use --defaults-extra-file -not- --defaults-file
[26 Aug 2013 7:15] MySQL Verification Team
Hello Bjoern,

Thank you for the report.
I can not repeat described behavior, could you please tell us whether you tried rpm/binary tar/source installation? or could you provide exact steps reproduce the issue?

Thanks,
Umesh

// I tried below steps and didn't see any problem

Steps followed:

// installed 5.6.13

 [ushastry@cluster-repo setups]$ sudo  rpm -ivh MySQL-server-5.6.13-1.el6.x86_64.rpm MySQL-devel-5.6.13-1.el6.x86_64.rpm MySQL-client-5.6.13-1.el6.x86_64.rpm MySQL-shared-5.6.13-1.el6.x86_64.rpm
 [sudo] password for ushastry:
 Preparing...                ########################################### [100%]
    1:MySQL-shared           ########################################### [ 25%]
    2:MySQL-client           ########################################### [ 50%]
    3:MySQL-devel            ########################################### [ 75%]
    4:MySQL-server           ########################################### [100%]
 [ushastry@cluster-repo setups]$

// Started mysql server

[ushastry@cluster-repo setups]$ sudo service mysql start
Starting MySQL..                                           [  OK  ]
[ushastry@cluster-repo setups]$

[root@cluster-repo ushastry]# more ~root/.mysql_secret
# The random password set for the root user at Tue Aug 27 09:26:56 2013 (local time): Xbra0YXX

[root@cluster-repo ushastry]# mysql -u root -pXbra0YXX
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.13

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
mysql> set password for 'root'@'localhost' = password('123');
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql>

//

[root@cluster-repo ushastry]# cd /tmp/
[root@cluster-repo tmp]# mysql_secure_installation

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.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] 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? [Y/n] n
 ... 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? [Y/n] n
 ... 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? [Y/n] n
 ... skipping.

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

Reload privilege tables now? [Y/n] n
 ... skipping.

All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

Cleaning up...
[26 Aug 2013 8:39] Bjoern Boschman
hm. this is kinda strage, as I cannot reproduce this on a clean VM by myself..

therefor I'll close this as cannot reproduce..