1.) Go to http://dev.mysql.com/downloads/mysql/ and download the file called Mac OS X ver. 10.x (x86, 32-bit), DMG Archive. You can use the 64bit version if you are sure your computer supports it, but the 32bit will work for everyone.
2.) Open the downloaded file and double click the file called mysql-x.x.xx-osx10.x-x86_32.pkg and continue through the installation.
3.) Once that is done, go back to the dmg file and open the MySQLStartupItem.pkg and go through a second installation process. This will start up MySQL each time you turn on your mac, but don't worry, it doesn't do much unless you tell it to.
NOTE: The official MySQL page on installing warns:
Due to a bug in the Mac OS X package installer, you may see this error message in the destination disk selection dialog:
You cannot install this software on this disk. (null)
If this error occurs, simply click the Go Back button once to return to the previous screen. Then click Continue to advance to the destination disk selection again, and you should be able to choose the destination disk correctly.
The above problem has not happened to me, but the info is useful just incase :)
4.) Now it's pretty much installed. You can start it up by opening a terminal, and typing: sudo /Library/StartupItems/MySQLCOM/MySQLCOM start and entering in your password if it asks. You could also just restart your Mac, and let the startup program do it for you.
If you want to start learning though, you'll need to do a couple more things in order to make life easier. See, when you open a terminal and type:
It's going to tell you that it can't find that command. This is because the shell doesn't know where to look for it yet. If you're only going to be playing around with it once, and only once, you can type these commands into the terminal one at a time:
This will make it start working, however the second you close terminal, it's going to forget again where mysql and mysqladmin are.
As a more long term solution, we're going to edit your PATH.
Every time you open terminal, it goes through a couple of files to set things up the way you like it. Every time you open terminal it refers to these files, so if you set it up once it will always know where to look for MySQL. That's what we're going to do next, tell it (in a permanent way) that mysql exists, and where it lives.
First, open up Terminal and type:
Then press enter. This just gets you to your home folder (if you aren't already there.) Now type:
Press enter. There's a good chance it's going to give you an error message, but that's ok too. If it does, enter the next command:
Then go back and try the open .profile line again. It should create a file called .profile, and then open it in textedit. If you were able to just open it, there are probably some lines of text here, but if not it will just be blank. You can ignore any text that is already there, and copy in the next lines:
The only space should be the one after export and before PATH. If there is another space somewhere, it won't work.
Save and close, then close Terminal and re-open, and you should be able to start up mysql from the command line.