I often need to do this so I figure I will write it down to remind myself later.
First, download the mysql installation dmg file (version 5.5.20 as of now). osx already comes with mysql but I like the extra System Pref icon after the manual install. You can download at http://dev.mysql.com/downloads/mysql/. Pick Mac OS X 10.6 (x86, 64-bit), DMG Archive. Once you have the dmg file, open and install all three files ( mysql-5.5.20-osx10.6-x86_64.pkg, MySQL.prefPane, MySQLStartupItem.pkg) in there.
Then in your ~/.bash_rc file, put in the following to save typing.
alias mysql=/usr/local/mysql-5.5.20-osx10.6-x86_64/bin/mysql
alias mysqladmin=/usr/local/mysql-5.5.20-osx10.6-x86_64/bin/mysqladmin
You can surely add /usr/local/mysql-5.5.20-osx10.6-x86_64/bin/ to the $PATH variable in your ~/.bash_profile file. Yea, whatever works.
PATH=/usr/local/mysql-5.5.20-osx10.6-x86_64/bin/:$PATH
Then turn on your MySQL daemon. An easy way is to open up System Preferences, then find the MySQL icon, open it. Then start the server and check the auto-start option below. If everything goes well, you will see the green running text.
Then set the root password for this database. The following set the root password to my_secret_password
$ mysqladmin -u root password my_secret_password
To change your root password, say from my_secret_password to abc123, do the following.
$ mysqladmin -u root -p 'my_secret_password' password 'abc123'
Alright, mysql is now up and running!
Bonus: To make your life a little easier, download Sequel Pro. It’s a free osx mysql gui.