Installing MySQL on Mac OS X

Installing MySQL on Mac OS X
Page content

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.

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.

Check Whether MySQL Is Really Running

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

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

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

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.