How do I install and run MySQL?
I installed MySQL:
but MySQL certainly isn't on the path when I open a terminal, nor do I see it in applications, as I seem to recall Windows handles MySQL.
Solution 1:
The mysql installer works just fine, I've used it many times.
However, it will never appear in Applications as it is not a GUI application.
And it won't appear in your terminal path unless you put it there. Mysql lives in /usr/local/mysql/bin/mysql. If you also install the Mysql preference pane you can start and stop mysqld via System Preferences.
There is absolutely no need to drag in an entire package manager (homebrew / macports / fink) for something that has an installer. That's like calling a moving company to put your dishes away.
Also consider that package managers typically require XCode as well - that's an additional 6+ Gb to install. Oracle's installer is 172Mb.
Solution 2:
My favourite way to install and run MySQL is via the Homebrew package manager. With Homebrew installed it's as straightforward as:
brew install mysql
This gets you the server and the command line connection tool. It's setup to run with no password, so it's not suitable for production use, but it's perfect for developing with. Homebrew takes care of putting everything you need on your PATH
for you, no digging around in .app
bundles for binaries.
Once installed, to connect:
mysql -uroot
To have launchd start mysql at login:
ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
Then you can start it with:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
Or if you don't care about having it start on machine boot/restart, you can just run the server directly with:
mysql.server start
The configuration file it reads will be in at /usr/local/etc/my.cnf
.
Bonus: having Homebrew on your system puts you one command call away from installing all kinds of other packages. It's a reasonable package manager without a lot of fluff and cruft.