Error message: sudo: mysql_secure_installation: command not found

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.


Solution 1:

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

Solution 2:

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

Solution 3:

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.