Friday, November 5, 2010

How to Easily Install MySQL on OS X

These are instructions to quickly and easily install MySQL on Snow Leopard, and will also work on Lion. I won't discuss mysqladmin or any other configurations on this post beyond those necessary to get the MySQL server running.

  1. Visit http://dev.mysql.com/downloads/mysql/. Make sure the platform is "Mac OS X".
  2. Click the "Download" button next to the 32- or 64-bit DMG archive. (For me, this was Mac OS X ver. 10.6 (x86, 32-bit), DMG Archive.)
  3. Let the .dmg file download, then open it. There should be a file called something similar to mysql-5.1.52-osx10.6-x86.pkg. Open it.
  4. Click through the installer with the default settings. The installation took about 10-15 seconds.
  5. The files install in /user/local/mysql/, so we need to set PATH variable to look in there. Create or edit a file in your home directory called .profile (make sure you include the ".") using TextEdit or the editor of your choice.
  6. Add this line to the file:
    export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
  7. You can then start the MySQL server by installing the prefPane (instructions below) or opening the Terminal and typing the following:
  8. sudo mysqld_safe &
  9. MySQL should now be installed and ready to use.

Optional installs:
  • Install MySQL.prefPane. This has GUI on/off switch and startup options:
    1. Return to the mounted disk with the MySQL installer.
    2. Double-click on MySQL.prefPane. It will install after you authenticate.
  • Install Sequel Pro. This is a free full-featured GUI interface for database creation/maintenance:
    1. Visit http://www.sequelpro.com/ and click the "Download" button.
    2. Let the .dmg file download, then open it.
    3. Drag Sequel Pro to your Applications folder.
  • Install MySQLWorkbench. This is the official, albeit less-polished, interface for database creation/maintenance:
    1. Visit http://dev.mysql.com/downloads/workbench/. Make sure the platform is "Mac OS X".
    2. Click the "Download" button next to the 32- or 64-bit DMG archive. (For me, this was "Mac OS X (x86, 32-bit), DMG Archive".)
    3. Let the .dmg file download, then open it.
    4. Drag MySQLWorkbench to your Applications folder.

1 comments:

Anonymous said...

I recommend Valentina Studio, which I find to be by far the best free MySQL-manager for OSX, check it out if you haven’t tried it yet: http://www.valentina-db.com/valentina-studio-overvie

Post a Comment