If you need a local instance of a mysql database for experiments and don’t really care about security as it’s not any production system here’s a quick way to install a mysql database on your OSX (tested with 10.9+)
- Download the latest OSX native package installation from the
download page. It should be a dmg
- Install it as any other OSX application. It will create under
/usr/local/mysql-x.y.z with a symlink to /usr/local/mysql the
entire directory structure that will be needed by mysql. From now
on I will refer as /usr/local/mysql directory.
- sudo rm -r /usr/local/mysql/data
- sudo mkdir /usr/local/mysql/data
- sudo chown -R <youruser> /usr/local/mysql/data
If everything worked out fine you should be able to start it with
$ mysqld_safe &
to stop it
$ mysqladmin -u root shutdown
I’ve created a couple of aliases and exports in my ~/.profile to ease the tasks
#MySQL export PATH=$PATH:/usr/local/mysql/bin alias mysql-start="mysqld_safe &" alias mysql-stop="mysqladmin -u root shutdown"