Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 kinda new to this but I am having issues with PHPMyAdmin as well as MySQL on my local machine. It has worked previously.

When I try to run mysql from the command line I get:

-bash: mysql: command not found

Additionally, PHPMyAdmin will not let me sign in either.

I don't know where to start looking to solve either of these issues. Please help.

share|improve this question

migrated from Jan 17 '10 at 6:57

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

Can you find the mysql installation? – Tor Valamo Jan 15 '10 at 11:19
This probably belongs on Which linux distro are you running (Ubuntu? SUSE? etc etc) – Paolo Jan 15 '10 at 11:20
Is the mysql daemon running? Try the command 'ps agx | grep mysqld' – Davide Gualano Jan 15 '10 at 11:27
@David,even if the daemon is not running,its mysql client which will err not bash – sud03r Jan 15 '10 at 11:29
@David @Neeraj I get this: 92 ?? S 0:00.02 /bin/sh ./bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/ 143 ?? S 0:03.68 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql --log-error=/usr/local/mysql/data/anonymous.bangmarketing.local.err --pid-file=/usr/local/mysql/data/ 21608 s000 R+ 0:00.01 grep mysqld What does that mean? I am running Mac OSX 10.5.8 – Shaun Jan 15 '10 at 11:33

Seems like the place your mysql binary is present doesnt happens to be in the PATH environment variable. If you know where it is installed, do
export PATH="$PATH:/location of binary"
If you want to do it permanently, add this statement in ~/.bashrc

share|improve this answer
Thanks for the help. How do I find out what the path of binary is? – Shaun Jan 15 '10 at 11:34
If you installed MySQL from the .dmg downloaded from, the path is usually /usr/local/mysql/bin/ – Davide Gualano Jan 15 '10 at 11:41
am I doing this correctly? pwd: ~ : export PATH="$PATH:/usr/local/mysql/bin > ~/.bashrc > – Shaun Jan 15 '10 at 11:51
I have to ctrl + c to get out of that command. Should typing mysql at this point work now? If so doesn't. – Shaun Jan 15 '10 at 11:57
No, you should open ~/.bashrc with a text editor like vim and paste there the command 'export PATH="$PATH:/usr/local/mysql/bin' – Davide Gualano Jan 15 '10 at 14:15

Directly from MySQL's additional notes section of their online documentation for OS X:

  • You might want to add aliases to your shell's resource file to make it easier to access commonly used programs such as mysql and mysqladmin from the command line. The syntax for bash is:
alias mysql=/usr/local/mysql/bin/mysql
alias mysqladmin=/usr/local/mysql/bin/mysqladmin
share|improve this answer
This worked on Weezy for me. – gearsandcode Aug 8 '15 at 21:37

If you are on Ubuntu there is a meta package named "mysql-client". Install that and mysql client utility should be there.

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.