MySQL command line with OS X 10.6.


After installing MySQL 5.1.54 on Mac OS X 10.6.6 (Snow Leopard) I tried to access the server in the terminal and got:

-bash: mysql: command not found

Bash could not find the path, so I had to add it. I am not that familiar with the internals of the unix terminal anyway, so I found a highly informative thread on superuser.com.

Especially the post of Jim Logan solved the issue:

Take a look at the file /etc/paths, which is used by /usr/libexec/path_helper, which is used by /etc/profile. For MacPorts, use “sudo” to append “/opt/local/bin” to the end of the /etc/paths file and reopen the terminal window.

So I opened the terminal and used nano:
sudo nano /etc/paths

and appended the line
/usr/local/mysql/bin

to the file, saved, exited, restarted the terminal …. and voila, solved.

Advertisement

11 thoughts on “MySQL command line with OS X 10.6.

    1. If you used nano then Ctrl-O saves and Ctrl-X exits. Might be that on Apple keyboard it is Cmd-O and Cmd-X (Cmd for the “Apple”-key).

    1. Then the path is not correct or changed. Try
      whereis mysql

      I dropped my Mac for a clean LinuxPC a dreadfully ugly Dell — the lack of flexibility in the OS X plastic zoo was even more anoying šŸ™‚ My point is I might not be so much of a help with the OS X/ BSD commandline… googling along the lines of “PATH variable mysql mac os x” should give you a lot of help. Good luck.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s