Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

migrated from Dec 2 '11 at 22:07

This question came from our site for professional and enthusiast programmers.

@Cfreak, it's not a command, but it is a program - mysql-secure-installation – Jason McCreary Dec 2 '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 2 '11 at 21:14
You should take a look at the documentation on installing MySQL 5.5 on Mac OS X – ub3rst4r Jan 4 '14 at 20:36

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.

share|improve this answer

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:


I assume you've followed the Reference Manual

share|improve this answer
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 – Craig Dec 2 '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. – Jason McCreary Dec 2 '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 2 '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? – Craig Dec 2 '11 at 21:37

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



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


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.