Bug #77044 yum installation of 5.7.7-0.3.rc does not seem to create .mysql_secret file
Submitted: 15 May 2015 2:37 Modified: 20 Nov 2015 15:02
Reporter: Fernando Ipar (OCA) Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Installing Severity:S3 (Non-critical)
Version:5.7.7-0.3.rc OS:Linux (CentOS 6.5)
Assigned to: CPU Architecture:Any

[15 May 2015 2:37] Fernando Ipar
Description:
The manual says at https://dev.mysql.com/doc/refman/5.7/en/linux-installation-rpm.html that rpm installation should create a .mysql_secret file in $HOME with the random password set for the root account, but this is not happening to me. 

I can verify by restarting the server with skip-grant-tables that a password is generated for root, but I can't find the .mysql_secret file either on /root or /home/vagrant (I'm running the installation via sudo as the vagrant user)

How to repeat:
I just install the release rpm, and then install mysql-server and mysql-client with yum. 
A transcript is below: 

[vagrant@mysql57 ~]$ rpm -qa|grep mysql
mysql-libs-5.1.71-1.el6.x86_64
mysql-community-release-el6-5.noarch

[vagrant@mysql57 ~]$ sudo yum-config-manager --enable mysql57-community-dmr
[vagrant@mysql57 ~]$ sudo yum-config-manager --disable mysql56-community

[vagrant@mysql57 ~]$ yum repolist all | grep mysql
Failed to set locale, defaulting to C
mysql-connectors-community        MySQL Connectors Community       enabled:   14
mysql-connectors-community-source MySQL Connectors Community - Sou disabled
mysql-tools-community             MySQL Tools Community            enabled:   23
mysql-tools-community-source      MySQL Tools Community - Source   disabled
mysql55-community                 MySQL 5.5 Community Server       disabled
mysql55-community-source          MySQL 5.5 Community Server - Sou disabled
mysql56-community                 MySQL 5.6 Community Server       disabled
mysql56-community-source          MySQL 5.6 Community Server - Sou disabled
mysql57-community-dmr             MySQL 5.7 Community Server Devel enabled:   82
mysql57-community-dmr-source      MySQL 5.7 Community Server Devel disabled

[vagrant@mysql57 ~]$ yum install mysql-server mysql-client
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror, security
You need to be root to perform this command.
[vagrant@mysql57 ~]$ sudo yum install mysql-server mysql-client
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: mirror.nbtelecom.com.br
 * extras: mirror.nbtelecom.com.br
 * updates: mirror.nbtelecom.com.br
mysql-connectors-community                                                                                            | 2.5 kB     00:00
mysql-tools-community                                                                                                 | 2.5 kB     00:00
mysql57-community-dmr                                                                                                 | 2.5 kB     00:00
Setting up Install Process
Package mysql-server is obsoleted by mysql-community-server, trying to install mysql-community-server-5.7.7-0.3.rc.el6.x86_64 instead
No package mysql-client available.
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:5.7.7-0.3.rc.el6 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 5.7.7-0.3.rc.el6 for package: mysql-community-server-5.7.7-0.3.rc.el6.x86_64
--> Processing Dependency: mysql-community-client(x86-64) = 5.7.7-0.3.rc.el6 for package: mysql-community-server-5.7.7-0.3.rc.el6.x86_64
--> Running transaction check
---> Package mysql-community-client.x86_64 0:5.7.7-0.3.rc.el6 will be installed
--> Processing Dependency: mysql-community-libs(x86-64) = 5.7.7-0.3.rc.el6 for package: mysql-community-client-5.7.7-0.3.rc.el6.x86_64
---> Package mysql-community-common.x86_64 0:5.7.7-0.3.rc.el6 will be installed
--> Running transaction check
---> Package mysql-community-libs.x86_64 0:5.7.7-0.3.rc.el6 will be obsoleting
---> Package mysql-libs.x86_64 0:5.1.71-1.el6 will be obsoleted
--> Processing Dependency: libmysqlclient.so.16()(64bit) for package: 2:postfix-2.6.6-2.2.el6_1.x86_64
--> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: 2:postfix-2.6.6-2.2.el6_1.x86_64
--> Running transaction check
---> Package mysql-community-libs-compat.x86_64 0:5.7.7-0.3.rc.el6 will be obsoleting
---> Package postfix.x86_64 2:2.6.6-2.2.el6_1 will be updated
---> Package postfix.x86_64 2:2.6.6-6.el6_5 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================
 Package                                    Arch                  Version                         Repository                            Size
=============================================================================================================================================
Installing:
 mysql-community-libs                       x86_64                5.7.7-0.3.rc.el6                mysql57-community-dmr                2.1 M
     replacing  mysql-libs.x86_64 5.1.71-1.el6
 mysql-community-libs-compat                x86_64                5.7.7-0.3.rc.el6                mysql57-community-dmr                1.6 M
     replacing  mysql-libs.x86_64 5.1.71-1.el6
 mysql-community-server                     x86_64                5.7.7-0.3.rc.el6                mysql57-community-dmr                 98 M
Installing for dependencies:
 mysql-community-client                     x86_64                5.7.7-0.3.rc.el6                mysql57-community-dmr                 19 M
 mysql-community-common                     x86_64                5.7.7-0.3.rc.el6                mysql57-community-dmr                319 k
Updating for dependencies:
 postfix                                    x86_64                2:2.6.6-6.el6_5                 base                                 2.0 M

Transaction Summary
=============================================================================================================================================
Install       5 Package(s)
Upgrade       1 Package(s)

Total download size: 123 M
Is this ok [y/N]: y
Downloading Packages:
(1/6): mysql-community-client-5.7.7-0.3.rc.el6.x86_64.rpm                                                             |  19 MB     00:03
(2/6): mysql-community-common-5.7.7-0.3.rc.el6.x86_64.rpm                                                             | 319 kB     00:00
(3/6): mysql-community-libs-5.7.7-0.3.rc.el6.x86_64.rpm                                                               | 2.1 MB     00:00
(4/6): mysql-community-libs-compat-5.7.7-0.3.rc.el6.x86_64.rpm                                                        | 1.6 MB     00:00
(5/6): mysql-community-server-5.7.7-0.3.rc.el6.x86_64.rpm                                                             |  98 MB     00:15
(6/6): postfix-2.6.6-6.el6_5.x86_64.rpm                                                                               | 2.0 MB     00:01
---------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                        5.7 MB/s | 123 MB     00:21
warning: rpmts_HdrFromFdno: V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Retrieving key from file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Importing GPG key 0x5072E1F5:
 Userid : MySQL Release Engineering <mysql-build@oss.oracle.com>
 Package: mysql-community-release-el6-5.noarch (@/mysql-community-release-el6-5.noarch)
 From   : file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : mysql-community-common-5.7.7-0.3.rc.el6.x86_64                                                                            1/8
  Installing : mysql-community-libs-5.7.7-0.3.rc.el6.x86_64                                                                              2/8
  Installing : mysql-community-client-5.7.7-0.3.rc.el6.x86_64                                                                            3/8
  Installing : mysql-community-libs-compat-5.7.7-0.3.rc.el6.x86_64                                                                       4/8
  Updating   : 2:postfix-2.6.6-6.el6_5.x86_64                                                                                            5/8
  Installing : mysql-community-server-5.7.7-0.3.rc.el6.x86_64                                                                            6/8
  Cleanup    : 2:postfix-2.6.6-2.2.el6_1.x86_64                                                                                          7/8
  Erasing    : mysql-libs-5.1.71-1.el6.x86_64                                                                                            8/8
  Verifying  : mysql-community-server-5.7.7-0.3.rc.el6.x86_64                                                                            1/8
  Verifying  : mysql-community-common-5.7.7-0.3.rc.el6.x86_64                                                                            2/8
  Verifying  : mysql-community-client-5.7.7-0.3.rc.el6.x86_64                                                                            3/8
  Verifying  : mysql-community-libs-compat-5.7.7-0.3.rc.el6.x86_64                                                                       4/8
  Verifying  : 2:postfix-2.6.6-6.el6_5.x86_64                                                                                            5/8
  Verifying  : mysql-community-libs-5.7.7-0.3.rc.el6.x86_64                                                                              6/8
  Verifying  : 2:postfix-2.6.6-2.2.el6_1.x86_64                                                                                          7/8
  Verifying  : mysql-libs-5.1.71-1.el6.x86_64                                                                                            8/8

Installed:
  mysql-community-libs.x86_64 0:5.7.7-0.3.rc.el6                     mysql-community-libs-compat.x86_64 0:5.7.7-0.3.rc.el6
  mysql-community-server.x86_64 0:5.7.7-0.3.rc.el6

Dependency Installed:
  mysql-community-client.x86_64 0:5.7.7-0.3.rc.el6                      mysql-community-common.x86_64 0:5.7.7-0.3.rc.el6

Dependency Updated:
  postfix.x86_64 2:2.6.6-6.el6_5

Replaced:
  mysql-libs.x86_64 0:5.1.71-1.el6

Complete!

[vagrant@mysql57 ~]$ sudo service mysqld start
Initializing MySQL database:  2015-05-15T02:32:34.211413Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
                                                           [  OK  ]
Starting mysqld:                                           [  OK  ]

[vagrant@mysql57 ~]$ sudo ls -lah /root/
total 64K
dr-xr-x---.  2 root root 4.0K Jan 16  2014 .
dr-xr-xr-x. 23 root root 4.0K May 14 19:20 ..
-rw-r--r--.  1 root root   18 May 20  2009 .bash_logout
-rw-r--r--.  1 root root  176 May 20  2009 .bash_profile
-rw-r--r--.  1 root root  176 Sep 22  2004 .bashrc
-rw-r--r--.  1 root root  100 Sep 22  2004 .cshrc
-rw-r--r--.  1 root root  129 Dec  3  2004 .tcshrc
-rw-------.  1 root root 1.3K Jan 16  2014 anaconda-ks.cfg
-rw-r--r--.  1 root root  18K Jan 16  2014 install.log
-rw-r--r--.  1 root root 5.7K Jan 16  2014 install.log.syslog
[vagrant@mysql57 ~]$ ls -lah
total 28K
drwx------. 3 vagrant vagrant 4.0K Jan 16  2014 .
drwxr-xr-x. 3 root    root    4.0K Jan 16  2014 ..
-rw-r--r--. 1 vagrant vagrant   18 Jul 18  2013 .bash_logout
-rw-r--r--. 1 vagrant vagrant  176 Jul 18  2013 .bash_profile
-rw-r--r--. 1 vagrant vagrant  124 Jul 18  2013 .bashrc
drwx------  2 vagrant vagrant 4.0K May 14 19:19 .ssh
-rw-r--r--  1 vagrant vagrant    5 Jan 16  2014 .vbox_version
[15 May 2015 10:30] MySQL Verification Team
Thank you for the bug report. Please check if it is duplicate or related to http://bugs.mysql.com/bug.php?id=76792. Thanks.
[15 May 2015 13:36] Fernando Ipar
Miguel, 

Thanks, yes, it seems to be a similar behaviour. 
In this case, I found the password in mysqld's log: 

/var/log/mysqld.log-2015-05-15T13:32:30.995159Z 1 [Warning] A temporary password is generated for root@localhost: Oh1SbNnsRB-M
[15 May 2015 14:31] MySQL Verification Team
Thank you for the feedback. Verified since the solution mentioned in http://bugs.mysql.com/bug.php?id=76792 only refers to MAC OS X packages.
[19 Nov 2015 19:45] Lester Guerzon
Also affects me.

[root@masterdb log]# rpm -qa | grep mysql
mysql-community-libs-5.7.9-1.el7.x86_64
mysql-community-common-5.7.9-1.el7.x86_64
mysql-community-client-5.7.9-1.el7.x86_64
mysql-community-libs-compat-5.7.9-1.el7.x86_64
mysql57-community-release-el7-7.noarch
mysql-community-server-5.7.9-1.el7.x86_64
[root@masterdb log]# uname -a
Linux masterdb 3.10.0-229.20.1.el7.x86_64 #1 SMP Tue Nov 3 19:10:07 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[root@masterdb log]#
[20 Nov 2015 3:43] Balasubramanian Kandasamy
Thanks for the bug report.

For MySQL 5.7, a temporary, random root password is generated and stored in the error log, which is /var/log/mysqld.log for an installation using the MySQL Yum repository. You can use this command to see the password:

shell > sudo grep 'temporary password' /var/log/mysqld.log
[20 Nov 2015 15:02] Paul DuBois
The referenced section of the manual
(https://dev.mysql.com/doc/refman/5.7/en/linux-installation-rpm.html)
says this:

" For MySQL 5.7.6 and up, the initial random root password is written to the error log. For MySQL 5.7.4 and 5.7.5, the password is written to the .mysql_secret file in the directory named by the HOME environment variable."

This bug report is filed against 5.7.7, so the part about .mysql_secret does not apply. The password will be found in the error log (which can be found as per an earlier comment).