I'm using mountain lion, I have installed MySQL.
It shows MySQL is running, but when I type
It gives error "mysql: command not found"
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
in .bashrc or .bash_profile file (cd ~/.bash_profile)
This will tell your terminal where to find mysql command.
command not found just means that the executable you're trying to run is not found in any of the directories in your $PATH environment variable.
The documentation links include a platform guide where it tells you that MySQL gets installed into /usr/local/, and then a symlink is created at
/usr/local/mysql that points to this install dir. Here you can see that I've installed two versions, and that symlink was updated on the last install:
$ ls -ld /usr/local/mysql* lrwxr-xr-x 1 root wheel 27 Apr 4 2012 /usr/local/mysql -> mysql-5.5.22-osx10.6-x86_64 drwxr-xr-x 3 root wheel 102 Apr 4 2012 /usr/local/mysql-5.5.18-osx10.6-x86_64 drwxr-xr-x 16 root wheel 544 Mar 2 2012 /usr/local/mysql-5.5.22-osx10.6-x86_64
I don't recall what change I made to put /usr/local/mysql/bin into my PATH, but in my opinion, the cleanest way to do that for all users is
sudo sh -c 'echo /usr/local/mysql/bin > /etc/paths.d/mysql'
and open a new tab in Terminal to get the effect immediately.