Do not be intimidated, it’s not that hard.
If you don’t mind reading a little documentation, the hardest thing about installing Mysql (IMO) is figuring out what package to install.
If you’ve previously tried and failed (and done who knows what to your local config) or if you don’t have a particular reason not to, why don’t you just get MAMP and skip all this?
USE THIS INFORMATION AT YOUR OWN RISK. Any information found on this website is offered only as informational and includes no warranty, guarantees or support. The author claims no authority on any subject whatsoever.
- Go to http://dev.mysql.com/downloads/mysql/
- This will offer latest version (yes, you want the MySQL Community Server, btw) – if you have a good reason, you can access a previous version from here as well.
- Choose the DMG Archive for your architecture (32-bit or 64-bit). You’ll have to log in or (more likely if you’re reading this article) register with MySQL. It’s annoying but fast and I’ve never received spam from them.
- After jumping through sign in and mirror download hoops you’ll have a DMG file, something like
mysql-5.x.x-osx10.6-x86.DMGwhich will contain an similarly named .pkg file. That’s all you need. But the most important file is the ReadMe.txt – which is actually useful and contains important steps you need to take. Open the ReadMe.txt.
- Read the ReadMe.txt file.
Ok, before you get mad at me – a lot of folks don’t provide useful ReadMe files, which is why I think it’s worth calling out in this case. Also, I saw so many tutorials on this, and worse, problems in forums where it was clear they didn’t follow the steps provided. Also, there are docs online that are mostly a repeat of this file – but it’s easy to accidentally read instructions for the wrong product version. So, as we OGs say, RTFM.
Following are notes from my specific install experience. It may be useful for you but you’ll need to verify your own system paths and configuration. Happy databasing!
- Restarted apache a whole bunch, can’t remember when or exactly when you need to but if something doesn’t work, that might help:
sudo apachectl -k restart
- I installed MySQLStartupItem.pkg – while regularly using it this makes sense, and it’s easy to stop auto startup when you’re done working on a project using mysql. Also the commands to start Mysql are much shorter this way and I’m lazy.
$ sudo /Library/StartupItems/MySQLCOM/MySQLCOM start (ENTER YOUR PASSWORD, IF NECESSARY)
- Update my PATH environment variable:
//make a back up in case you muck something up $ sudo cp /etc/paths /etc/paths_BAK // edit your paths file - see vi reference or using pico, vim, emacs whatever $ sudo vi /etc/paths // insert /usr/local/mysql/bin and then save/quit // test result $ echo $PATH // do you see /usr/local/mysql/bin in there somewheres? good! $ mysql // is bash prompt replaced with mysql> ? yay!
- Create a password for root:
$ mysqladmin -u root password aw3^s0mePAs5
More good notes (for 5.5, be sure to select correct manual option):
- Login, create a db, do stuff, lern stuff…
$ mysql --help
$ mysql -u root -p
mysql> SHOW DATABASES;
- Install a GUI - I like 'em, it's nice for visualization, although I think you definitely learn more & more better if you stick with CLI or at least the query window.
- Sequel Pro - recently turned onto this. LOVE it. Good review here.
- MySQL Workbench - the official one. Cause you're a company wo/man!
- PHP MyAdmin - cause you an OG! And/or you follow or make a lot of tutorials (most apache web hosts provide this).
- Querious - cause it's worth a few bucks for a nice user experience.
- Navicat - cause money is no object! (If that's the case, please get me a copy! Love but cannot justify $$ at this time.)