MySQL 5.1 Reference Manual  /  ...  /  General Notes on Installing MySQL on OS X

2.4.1 General Notes on Installing MySQL on OS X

You should keep the following issues and notes in mind:

  • OS X 10.4 deprecated startup items in favor of launchd daemons, and as of OS X 10.10 (Yosemite), startup items do not function. For these reasons, using launchd daemons is preferred over startup items.

  • The default location for the MySQL Unix socket is different on OS X and OS X Server depending on the installation type you chose. The following table shows the default locations by installation type.

    Table 2.11 MySQL Unix Socket Locations on OS X by Installation Type

    Installation TypeSocket Location
    Package Installer from MySQL/tmp/mysql.sock
    Tarball from MySQL/tmp/mysql.sock
    MySQL Bundled with OS X Server/var/mysql/mysql.sock

    To prevent issues, you should either change the configuration of the socket used within your application (for example, changing php.ini), or you should configure the socket location using a MySQL configuration file and the socket option. For more information, see Section 5.1.3, “Server Command Options”.

  • You may need (or want) to create a specific mysql user to own the MySQL directory and data. You can do this through the Directory Utility, and the mysql user should already exist. For use in single user mode, an entry for _mysql (note the underscore prefix) should already exist within the system /etc/passwd file.

  • If you get an insecure startup item disabled error when MySQL launches, use the following procedure. Adjust the pathnames appropriately for your system.

    1. Modify the mysql.script using this command (enter it on a single line):

      shell> sudo /Applications/
    2. Locate the option file that defines the basedir value and modify it to contain these lines:


      In the /Library/StartupItems/MySQLCOM/ directory, make the following group ID changes from staff to wheel:

      shell> sudo chgrp wheel MySQLCOM StartupParameters.plist
    3. Start the server from System Preferences or

  • Because the MySQL package installer installs the MySQL contents into a version and platform specific directory, you can use this to upgrade and migrate your database between versions. You will need to either copy the data directory from the old version to the new version, or alternatively specify an alternative datadir value to set location of the data directory.

  • You might want to add aliases to your shell's resource file to make it easier to access commonly used programs such as mysql and mysqladmin from the command line. The syntax for bash is:

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

    For tcsh, use:

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

    Even better, add /usr/local/mysql/bin to your PATH environment variable. You can do this by modifying the appropriate startup file for your shell. For more information, see Section 4.2.1, “Invoking MySQL Programs”.

  • After you have copied over the MySQL database files from the previous installation and have successfully started the new server, you should consider removing the old installation files to save disk space. Additionally, you should also remove older versions of the Package Receipt directories located in /Library/Receipts/mysql-VERSION.pkg.

Download this Manual
User Comments
Sign Up Login You must be logged in to post a comment.