I have MySql installed as part of MAMP on my MacBook Pro OS X 10.6.4. But Terminal responds to the mysql command with:

-bash: mysql: command not found

This:

sudo find / -name "mysql"

brings this:

/Applications/MAMP/db/mysql
/Applications/MAMP/db/mysql/mysql
/Applications/MAMP/Library/bin/mysql
/Applications/MAMP/tmp/mysql

Even when I try to launch mysql from those directories, it's not happening. What's up here?

link|improve this question
feedback

migrated from stackoverflow.com May 26 '11 at 0:45

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

1 Answer

up vote 0 down vote accepted

You want:

/Applications/MAMP/Library/bin/mysql

Which I just tried myself and it worked. You will of course need to pass it the proper login parameters as with standard mysql:

$ /Applications/MAMP/Library/bin/mysql -u root -h localhost -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.44 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 

You can also use a symlink to make things easier as described here:

http://www.aschroder.com/2009/03/how-to-use-the-mamp-mysql-command-line-client-in-a-terminal/

EDIT

An alternative is to install the official MySQL instead of using MAMP's version:

http://developer.apple.com/internet/opensource/osdb.html

link|improve this answer
Thanks for your help. Saved my day! Well wishes are now being sent to you across the aether. – user77510 May 26 '11 at 23:40
feedback

Your Answer

 
or
required, but never shown

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