9

I'm trying to learn PHP and I'm just in the process of installing apache,msql and PHP.

I'm on a mac osx 10.7.2

I downloaded: mysql-5.5.18-osx10.6-x86_64.dmg

I'm now at the point of setting the root password and when I type in: sudo: mysql_secure_installation it asks me to enter my password, then it says:

sudo: mysql_secure_installation: command not found

Any help would be appreciated.

Hennes
  • 64,768
  • 7
  • 111
  • 168
Craig
  • 101
  • 1
  • 2
  • 4
  • @Cfreak, it's not a command, but it is a program - [mysql-secure-installation](http://dev.mysql.com/doc/refman/5.1/en/mysql-secure-installation.html) –  Dec 02 '11 at 21:12
  • @JasonMcCreary you're right. I'm used to dealing with it on Linux. It's probably a path problem as you pointed out – Cfreak Dec 02 '11 at 21:14
  • You should take a look at the documentation on [installing MySQL 5.5 on Mac OS X](http://dev.mysql.com/doc/refman/5.5/en/macosx-installation-pkg.html) – SameOldNick Jan 04 '14 at 20:36

4 Answers4

13

If you install mariadb over a package manager you will end up with the same error nowadays which can be solved by using this which is the new mariadb name alternative:

mariadb-secure-installation
Unicornist
  • 251
  • 2
  • 5
  • 1
    Funny is that the instructions directly on MariaDB's [link](https://mariadb.com/resources/blog/how-to-install-mariadb-on-rhel8-centos8/) site shows to use `mysql-secure-installation` which is wrong and does not work. This is the correct answer. – Panama Jack Oct 23 '21 at 00:34
1

Your PATH is probably not updated since you used the DMG. As such you will need to run this with the full path or modify your PATH to include.

Probably something like:

/usr/local/mysql/bin/mysql_secure_installation

I assume you've followed the Reference Manual

  • Thanks for your help Jason, I just tried that and got a similar message: -bash: /usr/bin/mysql/mysql_secure_installation: No such file or directory –  Dec 02 '11 at 21:13
  • I'm not sure the exact path, been a while and I'm not on my Mac at the moment. See update. –  Dec 02 '11 at 21:15
  • You can use the locate command to try and find it. Or do an exhaustive search `find / | grep mysql_secure_installation`. You may also want to check into the macports version. That is what I run on my machine and it was really easy to setup. – Tim Dec 02 '11 at 21:23
  • Hi Tim, thanks I tried the find / | grep method and it returned: /usr/local/mysql-5.5.18-osx10.6-x86_64/bin/mysql_secure_installation , so I tried it and got the following: sudo /usr/local/mysql-5.5.18-osx10.6-x86_64/bin/mysql_secure_installation Password: Can't find a 'mysql' client in PATH or ./bin --- Does this mean anything to you? –  Dec 02 '11 at 21:37
1

This should work:

cd /usr/local/mysql
sudo bin/mysql_secure_installation

As the error message Can't find a 'mysql' client in PATH or ./bin says, mysql_secure_installation is looking for a mysql client in your PATH or ./bin directory - so if you want it to find /usr/local/mysql/bin/mysql, it should be started from /usr/local/mysql.

0

In my case:

ls -ld /usr/local/mysql*
lrwxr-xr-x   1 root  wheel   27 Apr 10 16:43 /usr/local/mysql -> mysql-5.6.24-osx10.8-x86_64
drwxr-xr-x  17 root  wheel  578 Apr 10 16:43 /usr/local/mysql-5.6.24-osx10.8-x86_64

So I set the new path into my PATH environment:

cd $HOME    
cat .bashrc 
export PATH="$PATH:/usr/local/mysql/bin/"
source .bashrc

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):

Cheers

Cris R
  • 101
  • 1