Académique Documents
Professionnel Documents
Culture Documents
About
Team
Work
Blog
Lab
Contact
I love MAMP for local development on Mac OS X – it gives you a quick LAMP-style development
environment on your machine with zero hassle – and it’s free.
If you’re a user who also likes using MySQL on the command line to manage your local databases
though, it might be a little confusing, because after installing MAMP you can’t do so. Just run this in
terminal and you should be set:
sudo ln -s /Applications/MAMP/Library/bin/mysql /usr/local/bin/mysql
What this does is add a symbolic link for the mysql binary from MAMP into your executable path – in
this case, within /usr/local/bin/
Incidentally, /Applications/MAMP/Library/bin/ is where you’ll also find all the other MySQL
binaries, like mysqldump.
Warning: If you’ve installed MySQL manually as well, this may interfere with that installation, so don’t
do this if you have!
31 Responses
1. 4/7/2008
Thanks!
2. 4/29/2008
ali said:
3. 4/29/2008
ali,
1: note that that is LN, not IN – ‘LN’ lowercase.
2: If you’ve already done that, what version of Mac OS X are you running?
4. 7/31/2008
tomo said:
5. 10/9/2008
julien said:
6. 12/11/2008
Gary said:
I tried this and it says ln: /usr/local/bin/mysql: No such file or directory …… help?
7. 12/11/2008
8. 12/22/2008
Jim said:
Chris:
I just copied and posted exactly what you wrote into terminal, and got back:
ln: /usr/local/bin/mysql: No such file or directory
I’m on 10.5.6.
9. 12/22/2008
Chris D said:
Hi Jim,
Not sure why the /usr/local/bin directory wouldn’t exist. Try typing this beforehand:
sudo mkdir -p /usr/local/bin
What this will do is create the /usr/local/bin directory for you if it doesn’t already exist.
You might also want to check “echo $PATH” to make sure /usr/local/bin exists within your
executable path.
If it doesn’t exist in the string that comes out (separated by colons), just type:
open ~/.profile
and add:
export PATH=$PATH:/usr/local/bin
to that file, and restart your Terminal and you should be all set.
Hope this helps!
10. 1/8/2009
Simon said:
11. 3/14/2009
alex said:
Before creating the symbolic link that Chris suggested here, I would get “mysql: command not
found” unless I entered the whole path such as
/Applications/MAMP/Library/bin/mysql -u root -p
and in that case I would get a blank prompt and nothing would happen.
Now I get the blank prompt if I run any mysql command (including mysql –help), which I
suppose is however a kind of progress.
Does anyone know what’s wrong here? There may be a conflict with prior failed installations. I
tried to install mysql previously with macports, but I uninstalled it later. I have a ruby on rails
stack installed as well, but there’s no mysql support there. I’ve just been using Sqlite3. I don’t
know if there could be a potential conflict with another mysql installation or not. How can I
check? Or is there another solution that occurs to anyone?
I know that mysql is running–I can use phpmyadmin and query databases with php–but I’d really
like to be able to use the command line! Any help is much appreciated!
12. 8/1/2009
Hey Jim,
Try This:
/usr/local/mysql/bin/mysql
13. 9/4/2009
tomo said:
Thanks!
14. 9/11/2009
Stefan said:
Hey there!
I’ve done as you said, but i get the following massage:
110:~ appleuser$ sudo ln -s /Applications/MAMP/Library/bin/mysql /usr/local/bin/mysql
WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type “man sudo” for more information.
To proceed, enter your password, or type Ctrl-C to abort.
Password:
ln: /usr/local/bin/mysql: No such file or directory
110:~ appleuser$
Any idea what it could be?
I run MySQL and MAMP on a MacBook Pro with OS 10.5.6.
15. 9/11/2009
Stefan said:
Ohhh, sorry! I just read the other comments up there and found the solution. Thanks a lot to all of
you! That was a great help!!!
16. 10/14/2009
Thanks, this worked great with one modification. I think the bin directory is not in the same spot
on all OSX installations as a lot of people seem to be having issues. I went and manually looked
for it and saw it was /usr/bin/ and not /usr/local/bin. Modified command below worked perfect for
me.
betz said:
18. 10/24/2009
Ian/Betz:
I’m willing to bet the problem was that /usr/local/bin was not in your PATH.
If you do “echo $PATH | grep /usr/local/bin” does anything show up? If not, you need to add
/usr/local/bin to your PATH, which you can do by typing:
Putting the link into /usr/bin works as well of course, but /usr/local/bin is usually reserved for
user-written tweaks and scripts.
19. 10/27/2009
rafaelxy said:
guys, some recent Mac OS X versions, mine 10.6, doesnt have /usr/local/bin but it does have
/opt/local/bin
just echo $PATH and check it out. Im guessing apple changed that for some reason
20. 10/30/2009
Saïd said:
Thanks !!!!!
you save me from be lost in my exercise !!!
thanks again….
21. 12/16/2009
Pepitoto said:
“WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type “man sudo” for more information.
Password:”
22. 12/17/2009
gmnote said:
Thanks, very useful. Also using Sequel Pro (http://www.sequelpro.com/) if you like GUI based
stuff
23. 12/26/2009
Thanks a lot Chris! I was importing a large sql file into MAMP MySQL and wanted to avoid
phpMyAdmin size limitation by going straight to command line to do the import. Worked like a
charm.
24. 2/19/2010
bauer said:
Really thanks man, I was looking for this because my “mysqldump” command didn’t work and
this solution is perfect for me.
25. 3/30/2010
RNiles said:
Hi there please forgive my inexperience in this but I have downloaded MAMP for my MacBook
Pro and got it up and running. I’m new to this and am using this to try and learn more on php and
mysql but I wanted to know how do I execute this? –
“If you’re a user who also likes using MySQL on the command line to manage your local
databases though, it might be a little confusing, because after installing MAMP you can’t do so.
Just run this in terminal and you should be set:”
Where would I find the “command line” or where is the “terminal” where this should be run.
Again sorry for this newbie ? I’m reading through the net and some books and though it will take
me some time just wanted to try and get my feet wet a bit in this new environment.. thank you for
reading!
26. 8/16/2010
Can you reverse this if you think you have done the wrong thing?
27. 10/7/2010
RP said:
29. 11/8/2010
frob said:
Leave a Comment
Name
Website
Submit Comment
Connect With Us
Tel 212.400.6296
Email contact@arc90.com
VCard Download