Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shortcut to MySql on Mac OS X?

Tags:

path

mysql

macos

I am trying to add a path so I don't have to keep typing usr/local/mysql/bin every time I want to start Mysql. I found instructions here that say:

Edit the file /etc/profile and update the path by adding: usr/local/mysql/bin/, for example: PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/mysql/bin"

Problems:
1. There is no existing line in my profile file that says 'path'. This is what it currently says in profile: # System-wide .profile for sh(1)

if [ -x /usr/libexec/path_helper ]; then
    eval '/usr/libexec/path_helper -s'
fi
if [ "${BASH-no}" != "no" ]; then
    [ -r /etc/bashrc ] && . /etc/bashrc
fi

2. I really have no idea what I'm doing on a mac (yet). What do I add/change to the above file so mysql is easier to access?

like image 490
sscirrus Avatar asked Dec 10 '10 01:12

sscirrus


1 Answers

It depends on whether or not you want all user accounts to have access to MySQL, or just you.

For everyone, edit /etc/profile as instructed and add the following to the end:
export PATH=$PATH:usr/local/mysql/bin

For just you (ALSO, this is safest so you don't accidentally mess up any system variables!):

Get a terminal session: Launch Terminal if it's not already running.

Make sure you're in your home directory:
CD ~

See if .bash_profile exists:
ls -al .b*

If it does, open it with your favorite text editor. If it doesn't, launch your favorite text editor and Save as... .bash_profile in your home folder.

Add this line to .bash_profile and Save:
export PATH=$PATH:/usr/local/mysql/bin

Then close Terminal and open again for the change to take effect.


Hope this works out for you.

like image 170
MattT Avatar answered Nov 04 '22 03:11

MattT