Pin Me

How to Install MySQL on Mac OS X

written by: •edited by: Michael Dougherty•updated: 1/9/2010

This article takes you through all the steps you need to install and set up MySQL on your Mac OS X system.

  • slide 1 of 6

    Download The Package

    First of all you need to download the MySQL installation package from the MySQL website. Go to the website and click on the download link. Choose the package download for your version of Mac OS X. For recent Macs you can use the x86_64 version.

  • slide 2 of 6

    Install All The Package Contents

    After downloading the package, install it on your machine. Also run the MySQL.perfPane and MySQL.Startupitem files from the installation package. These programs will start the database automatically on system start up and allow you to control this.

  • slide 3 of 6

    Check Whether MySQL Is Really Running

    After installing MySQL, open the MySQL preferences to check whether the database is running.

    MySQL Server 

  • slide 4 of 6

    Setup The Command Line Tools

    After the installation of MySQL, one of the things to do is setting of the paths for MySQL command line tools. To set the paths, open a terminal window (from the Utilities folder) and enter the following command:

    echo ‘export PATH=/usr/local/mysql/bin:$PATH’ >> ~/.profile

  • slide 5 of 6

    Set A Password On Your Database Server

    It is best to disable the default database root user and add a new user. You can add many databases and users, depending on your requirements.

    At this point, we’ll set a password to the root user. To do this, open a terminal window and type:

    mysqladmin -u root password YourNewPassword

    To change the initial password sometime in the future, use the following command

    mysqladmin -u root -p YourOldPassword password YourNewPassword

    Note: Replace YourOldPassword, YourNewPassword with the actual passwords

  • slide 6 of 6

    Set Up The Manual Pages

    If you need any sort of help in using the command line tools, the manual pages are a useful resource for guidance. The manual pages come with MySQL but are not completely set up by the installation. Setting up the manual pages is a one minute job. Just open the terminal again and enter the following commands:

    MANPATH=/usr/local/mysql/man:$MANPATH’ >> ~/.profile

    sudo /usr/libexec/makewhatis

    If all went successfully, you will be able to access the manual pages by entering man myql in the terminal window.