Mantis - mysql5
Viewing Issue Advanced Details
4798 packaging minor always 2011-06-30 11:45 2012-03-25 22:03
AirOnSkin  
maciej  
normal  
closed  
fixed  
none    
none  
0004798: mysql_secure_installation returns error with current mysql5 package
After installing mysql5 and running mysql_secure_installation the script breaks at the second action (removing anonymous user) because the first action (setting the root password) doesn't work. The new root password doesn't get applied (even if the output says so), hence the script has no rights for the second action.

After typing the new root password twice the following appears (full log attached):

Reloading privilege tables..
/opt/csw/mysql5/bin/sparcv9/mysql_secure_installation: !: not found
log file icon mysql5-secure-installation.log [^] (1,518 bytes) 2011-06-30 11:45
log file icon mysql-secure-install-extended.log [^] (10,604 bytes) 2011-07-07 13:17
Issue History
2011-06-30 11:45 AirOnSkin New Issue
2011-06-30 11:45 AirOnSkin File Added: mysql5-secure-installation.log
2011-06-30 15:10 bwalton Project apache2 => mysql5
2011-06-30 15:10 bwalton Note Added: 0009168
2011-07-01 11:58 AirOnSkin Note Added: 0009169
2011-07-07 13:17 AirOnSkin File Added: mysql-secure-install-extended.log
2011-07-07 13:25 AirOnSkin Note Added: 0009186
2011-07-07 13:27 AirOnSkin Note Edited: 0009186
2011-08-30 00:31 maciej Note Added: 0009247
2011-09-21 14:02 AirOnSkin Note Added: 0009292
2011-09-21 14:26 AirOnSkin Note Added: 0009293
2011-09-21 14:28 AirOnSkin Note Edited: 0009293
2011-10-03 13:44 AirOnSkin Note Added: 0009318
2011-10-05 10:25 maciej Status new => assigned
2011-10-05 10:25 maciej Assigned To => maciej
2012-03-25 22:03 maciej Note Added: 0009767
2012-03-25 22:03 maciej Status assigned => closed
2012-03-25 22:03 maciej Resolution open => fixed

Notes
(0009168)
bwalton   
2011-06-30 15:10   
Moved this ticket to the correct package.
-Ben
(0009169)
AirOnSkin   
2011-07-01 11:58   
I'll test it on a fresh install next week. It seems only the password changeing doesn't work.
(0009186)
AirOnSkin   
2011-07-07 13:25   
(edited on: 2011-07-07 13:27)
I've tested the issue on a freshly installed solaris and uploaded the log file (mysql-secure-install-extended.log).

My experience:
* There are 3 scripts on the system, they all behave the same.
* All operations except setting the password work. If you start the script and choose to not change the root pw all other steps complete successfully (see try4).
* When executing the script after a couple of minutes after I tried to change the root password (see try1-try3 in the log file) the script does not accept the default password (which is empty upon mysql installation) anymore. Instead the password I wanted to change the default to is being used (see try5 in the log file). Very strange oO

I hope that helps.

Cheers,
Stefan

(0009247)
maciej   
2011-08-30 00:31   
The suspicion is that there is a hardcoded reference to /bin/sh, which does not support the "if ! foo; then bar; fi" syntax. The mysql sources need to be examined and potentially patched to use e.g. /opt/csw/bin/bash instead.
(0009292)
AirOnSkin   
2011-09-21 14:02   
maciej's guess was right. When downloading the mysql-5.0.87 source, there's a file called scripts/mysql_secure_installation.sh which calls /bin/sh.

The function (see here: http://paste.pocoo.org/show/479787/) [^] that changes the root password uses ! at two points. The thing that doesn't actually work is reloading the privileges and since there's not check if that was successful no error is being displayed (instead the script happily shouts "Password updated successfully!")

Either one changes the script to use another shell instead or the code needs to be edited to work with sh.
(0009293)
AirOnSkin   
2011-09-21 14:26   
(edited on: 2011-09-21 14:28)
This issue has already been reported to the MySQL guys. See here: http://bugs.mysql.com/bug.php?id=48086 [^]

Newer versions of MySQL include a script which still calls /bin/sh but abandons the use of the "if ! foo; then bar; fi" syntax.

(0009318)
AirOnSkin   
2011-10-03 13:44   
The new packet version 5.0.92 solves this problem. Now the privileges get updatet correctly.
(0009767)
maciej   
2012-03-25 22:03   
Thanks for the feedback.