tags:

views:

96

answers:

3

I am quite new to the Macintosh, I have Mac OS 10.6 installed.

I downloaded the mysql-5.4.3-beta-osx10.5-x86.dmg file and installed all the files properly.

I have got MySQL server started in system preferences.

Now I want to access MySQL from the terminal but I am unable to do it.

I have tried mysql -u root.

It shows "-bash: mysql: command not found".

How can I make it work?

Is there any tool like phpMyAdmin for Mac?

A: 

Please RTFM first.

A: 

To expand on lutz's (rather brusque) answer, if you look near the bottom of the Mac OS X installation manual you'll see the lines

alias mysql=/usr/local/mysql/bin/mysql
alias mysqladmin=/usr/local/mysql/bin/mysqladmin

These are commands that tell your shell, bash, "when I type mysql I really mean to execute /usr/local/mysql/bin/mysql." You can add these commands to the end of the file .bash_profile in your user's home directory (using echo in conjunction with >>~/.bash_profile or similar) so that they get run every time you launch a shell.

Better yet, use the same file to change your PATH environment variable. Doing something like

export PATH="/usr/local/mysql/bin:${PATH}"

will tell the shell that any executable files found in that directory (like mysql, mysqladmin, and so forth) should be executed when you type just their names, rather than the full path.

Tim
please make this answer more clear....
Ankit Sachan
If that answer doesn't seem clear enough, then you are probably new to UNIX-y shells in general, for this is `really` basic stuff that you will need to know. Try reading one of the many tutorials out on the web on shell PATHs and shell aliases.
Ned Deily
A: 

It sounds like you have a path problem in the current shell. Some steps to check/do are:

  • Can you get to the MySQL prompt from the installed location ? Let's assume that you have installed MySQL in /usr/local/mysql. Then if you change directory (cd /usr/local/mysql/bin) you should be able to execute the mysql command: ./mysql

  • Check the path settings via env command in your current shell. What you are looking for is the value of PATH where you want to have something along the lines of: PATH=/usr/local/bin:/bin:/usr/bin:/usr/sbin..... with some reference to mysql's installled path

  • Reset your current path to include /usr/local/bin. This can be done in the instance of the current shell via export PATH=/usr/local/mysql/bin:/usr/local/bin:$PATH

  • Test that you can then access the mysql binary from any path on your system.

In terms of the tools for accessing MySQL you can take a look at:
- SequelPro
- MySQL Tools

Grant Sayer