1

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.

Shaun
  • 149
  • 2
  • 2
  • 7
  • Can you find the mysql installation? –  Jan 15 '10 at 11:19
  • 1
    This probably belongs on superuser.com. 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/anonymous.bangmarketing.local.pid 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/anonymous.bangmarketing.local.pid 21608 s000 R+ 0:00.01 grep mysqld What does that mean? I am running Mac OSX 10.5.8 –  Jan 15 '10 at 11:33
  • It means that the daemon is running. We know then that mysql is correctly installed. – Davide Gualano Jan 15 '10 at 11:41
  • How do I check that? –  Jan 15 '10 at 11:53

3 Answers3

2

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

sud03r
  • 191
  • 3
  • Thanks for the help. How do I find out what the path of binary is? –  Jan 15 '10 at 11:34
  • If you installed MySQL from the .dmg downloaded from mysql.com, 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 > –  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. –  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
  • You're also forgetting to close the double quote. Run this: 'export PATH=$PATH:/usr/local/mysql/bin'(without single quotes) and add the same line in .bashrc. – Kevin M Jan 17 '10 at 12:56
1

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
Zayne S Halsall
  • 1,902
  • 15
  • 19
0

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

proy
  • 1,179
  • 8
  • 10