Bug #52274 Missing path to mysql in mysql_secure_installation
Submitted: 22 Mar 2010 13:23 Modified: 14 Oct 2010 14:27
Reporter: ilke demir Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: General Severity:S2 (Serious)
Version:5.1.45 OS:Mac OS X (10.5.8 Leopard)
Assigned to: Georgi Kodinov CPU Architecture:Any
Tags: bin/mysql, mysql_secure_installation
Triage: Triaged: D2 (Serious)

[22 Mar 2010 13:23] ilke demir
Description:
I have downloaded and installed the version at http://www.mysql.com/downloads/mirror.php?id=385547, Mac OS X 10.5 (x86, 32-bit), DMG Archive. After steps done successfully, when I tried to run mysql_secure_installation, I have come across with the following situation:

"
new-host:mysql user$ sudo bin/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): 
bin/mysql_secure_installation: line 43: mysql: command not found
OK, successfully used password, moving on...

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

Set root password? [Y/n] Y
New password: 
Re-enter new password: 
bin/mysql_secure_installation: line 43: mysql: command not found
Password update failed!
"

When I look at the mentioned line in mysql_secure_installation, the line was like:

"    mysql --defaults-file=$config <$command  "

but since the installation did not copy mysql into /bin/ directory, this line was not working properly. 

How to repeat:
With running bin/mysql_secure_installation again.

Suggested fix:
Fix 1: ./bin/mysql (I mean inside the mysql directory), can be carried to /bin/mysql

Fix 2: line 43 in mysql_secure_installation can be changed as:

"    bin/mysql --defaults-file=$config <$command  "
[22 Mar 2010 14:40] Valeriy Kravchuk
Verified just as described:

77-52-28-202:mysql openxs$ sudo bin/mysql_secure_installation 
Password:

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): 
bin/mysql_secure_installation: line 43: mysql: command not found
OK, successfully used password, moving on...

...

Line 43 is here:

do_query() {
    echo "$1" >$command
    #sed 's,^,> ,' < $command  # Debugging
    mysql --defaults-file=$config <$command # this is line 43
    return $?
}

and typical PATH is like this:

77-52-28-202:mysql openxs$ sudo echo $PATH
/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

(no /usr/local/mysql/bin there). Hence the error message.
[20 May 2010 2:32] philippe beaucart
Same error on Debian Lenny
[9 Jul 2010 10:53] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/113226

3470 Georgi Kodinov	2010-07-09
      Bug #52274 : Missing path to mysql in mysql_secure_installation
      
      Added some code to try to find the mysql command line in the most 
      common places and stop if it's not there.
[9 Jul 2010 11:12] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/113228

3470 Georgi Kodinov	2010-07-09
      Bug #52274 : Missing path to mysql in mysql_secure_installation
            
      Added some code to try to find the mysql command line in the most 
      common places and stop if it's not there.
[14 Jul 2010 9:45] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/113527

3478 Georgi Kodinov	2010-07-09
      Bug #52274 : Missing path to mysql in mysql_secure_installation
            
      Added some code to try to find the mysql command line in the most 
      common places and stop if it's not there.
[23 Jul 2010 12:21] Bugs System
Pushed into mysql-trunk 5.5.6-m3 (revid:alik@sun.com-20100723121820-jryu2fuw3pc53q9w) (version source revid:vasil.dimov@oracle.com-20100531152341-x2d4hma644icamh1) (merge vers: 5.5.5-m3) (pib:18)
[23 Jul 2010 12:29] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100723121929-90e9zemk3jkr2ocy) (version source revid:vasil.dimov@oracle.com-20100531152341-x2d4hma644icamh1) (pib:18)
[28 Jul 2010 19:46] Paul Dubois
Noted in 5.1.50, 5.5.6 changelogs.

mysql_secure_installation sometimes failed to locate the mysql 
client.
[19 Aug 2010 15:41] Bugs System
Pushed into mysql-5.1 5.1.51 (revid:build@mysql.com-20100819151858-muaaor6jojb5ouzj) (version source revid:build@mysql.com-20100819151858-muaaor6jojb5ouzj) (merge vers: 5.1.51) (pib:20)
[14 Oct 2010 8:25] Bugs System
Pushed into mysql-5.1-telco-7.0 5.1.51-ndb-7.0.20 (revid:martin.skold@mysql.com-20101014082627-jrmy9xbfbtrebw3c) (version source revid:martin.skold@mysql.com-20101014082627-jrmy9xbfbtrebw3c) (merge vers: 5.1.51-ndb-7.0.20) (pib:21)
[14 Oct 2010 8:40] Bugs System
Pushed into mysql-5.1-telco-6.3 5.1.51-ndb-6.3.39 (revid:martin.skold@mysql.com-20101014083757-5qo48b86d69zjvzj) (version source revid:martin.skold@mysql.com-20101014083757-5qo48b86d69zjvzj) (merge vers: 5.1.51-ndb-6.3.39) (pib:21)
[14 Oct 2010 8:55] Bugs System
Pushed into mysql-5.1-telco-6.2 5.1.51-ndb-6.2.19 (revid:martin.skold@mysql.com-20101014084420-y54ecj85j5we27oa) (version source revid:martin.skold@mysql.com-20101014084420-y54ecj85j5we27oa) (merge vers: 5.1.51-ndb-6.2.19) (pib:21)
[14 Oct 2010 14:27] Jon Stephens
Already documented in the 5.1.50 changelog; no additional changelog entries required. Set back to Closed state.