Installing mySQL on Mountain Lion (OSX 10.8) and Mavericks (OSX 10.9)

Download the latest version from

http://dev.mysql.com/downloads/mysql/

Select your Platform, the download

(Note: Mac OS x ver. 10.7rc will work on Mountain Lion)

I selected the _64 bit version

Installing MySQL on your Apple Mac

  1. Download the software

    http://www.mysql.com/downloads/mysql/

    {Slide 01}

    Select which operating system version you wish to run your mySQL on

    {Slide 02}

    Then choose which install file best suits your fancy

    - Format options are .tar or .dmg

    - OS versions are designed for either x86,32-bit or x86,64-bit

    Recommend x86,64-bit in the .dmg format for all Macs running OSX 10.4 or greater - adapt as required for your machine

    (see the Apple Menu - About this Mac to see if you are supporting 32 or 64 bit)

    {Slide 03}

    Click "Download" button

    You will be prompted for a login screen if you are not already a MySQL site member

    Your choice if you want to login in or not

    If so, then use an existing login, or create a new one. Site membership offers you access to such things as forums etc.

    Otherwise, click the "Download without logging in" button

    {Slide 04}

    ??

    {Slide 05}

    The download should begin immediately

    {Slide 06}

    After downloading, if you chose a .dmg format, then the .dmg will autolaunch

    {Slide 07}

    If you chose a .tar format, then put the .tar file (that was saved in your current Downloads folder or somewhere else you may have specified) into a folder where you desire to uncompress it. Double-click the .tar file from within a finder window to decompress it. It should then reveal a .dmg file to install from.

  2. Install the software

    If the .dmg is not already autolaunched, launch it.

    You will see 4 files:

    a) mysql-5.6.13-osx10.7-x86_64.pkg

    b) MySQL.prefPane

    c) MySQLStartupItem.pkg

    d) ReadMe.txt

    {Slide 07}

    NOTE: newer versions or other choices you made as to format will be reflected in the first file's name (mysql-X.Y.Z; osx-MM.N; x86_BB -- where XYZ are the version of mysql, MN are your Mac OSX version, and BB is either 32 or 64 for which mode you wish to run your mysql server in 32-bit or 64-bit)

      Install MySQL
    1. Double-click the mysql-X.Y.Z-osx-MM.N-x86_BB.pkg file

      {Slide 08}

      Click Continue

      Take note of the ReadMe step within the .dmg installation (2nd step) to check for special instructions (like shutting down an existing mysql server which is required before a new installation or update - if you need to do this, the ReadMe file's reference to "on the command line" means you need to execute an instruction in a window belonging to your Terminal application which is found in your Applications/Utilities folder). Also take note in the ReadMe file for comments about known errors or bugs that may have work-arounds you need to follow.

      Follow the default instructions

      - license

      - destination select

      - installation type

      - installation

      - summary

    2. Install the MySQL Preferences Pane

      Double-click: MySQL.prefPane

      Systems Preferences app should open and then prompt you to indicate whether or not the prefPane should be installed just for your login or everyone's login. Click Install. You may be prompted for an admin password. The result then should be that System Preferences has its new MySQL prefPane open, but the server is "off."

      Click "Start MySQL Server"

    3. Install automatic startup

      Double-click: MySQLStartupItem.pkg

  3. Configure the software

    Follow the instructions - default choices are recommended

    1. Ensure the socket link is correct (a known bug)

      In Terminal

      Type $ ls -la /tmp

      (Or, you might see /tmp redirected to /private/tmp where you will find the next line....)

      Should now see an entry mysql.sock=

      Note: On OS X 10.9 (Mavericks), the '=' doesn't show.

      which is automatically created by running MySQL server

    2. Set initial root passwords for security sake

      Open a Terminal application window

      At the commandline prompt type the following commands:

      cd /usr/local/mysql/bin

      Setup administrator password for mysql

      mysql -u root mysql

      Now, in mysql:

      mysql> UPDATE mysql.user SET Password="MYPASSWORD" WHERE User="root";

      mysql> flush privileges;

      mysql> select host,user,password from mysql.user;

      mysql> quit;

      Now, back in the shell:

      mysqladmin -u root password 'MYPASSWORD' 

      mysql -u root -pMYPASSWORD

      (NOTE: no space after the -p !!!)

    3. sudo mkdir /var/mysql

      sudo ln -s /private/tmp/mysql.sock /var/mysql/mysql.sock

    4. Setup MySQL System Preferences

      {Slide }

      Look for MySQL

      {Slide }

      Click on it and to bring up the MySQL System Preferences pane

      {Slide }

      Choose whether or not you want to "Automatically Start MySQL Server on Startup"

      (It is recommended that you do)

  4. Notes & Remedies that may come in handy

    1. To save some time in the future when doing administrative work on the mysql server, place the following commands into a .bashrc file in your personal login directory. Detailed instructions for setting up a .bashrc and .bashrc_profile file, are found here.

      In .bashrc:

      alias mysql=/usr/local/mysql/bin/mysql

      alias mysqladmin=/usr/local/mysql/bin/mysqladmin

      alias gomysql="cd /usr/local/mysql/bin"

      In .bashrc_profile

      add to the PATH variable:

      /usr/local/mysql/bin:

    2. Resetting the root password of mysql

      Notes found in: SEMP_dokimaysw_local.docx

    3. lost the mysql.sock connection - these didn't work http://blog.salientdigital.com/2011/09/08/how-to-install-mysql-5-5-on-mac-os-x-10-7-lion/