2 2.4. Installing MySQL on Mac OS X
4 MySQL for Mac OS X is available in a number of different forms:
6 * Native Package Installer format, which uses the native Mac OS
7 X installer to walk you through the installation of MySQL. For
8 more information, see Section 2.4.2, "Installing MySQL on Mac
9 OS X Using Native Packages." You can use the package installer
10 with Mac OS X 10.3 and later, and the package is available for
11 both PowerPC and Intel architectures, and 32-bit and 64-bit
12 architectures. There is no Universal Binary available using
13 the package installation method. The user you use to perform
14 the installation must have administrator privileges.
16 * Tar package format, which uses a file packaged using the Unix
17 tar and gzip commands. To use this method, you will need to
18 open a Terminal window. You do not need administrator
19 privileges using this method, as you can install the MySQL
20 server anywhere using this method. For more information on
21 using this method, you can use the generic instructions for
22 using a tarball, Section 2.2, "Installing MySQL on Unix/Linux
23 Using Generic Binaries."You can use the package installer with
24 Mac OS X 10.3 and later, and available for both PowerPC and
25 Intel architectures, and both 32-bit and 64-bit architectures.
26 A Universal Binary, incorporating both Power PC and Intel
27 architectures and 32-bit and 64-bit binaries is available.
28 In addition to the core installation, the Package Installer
29 also includes Section 2.4.3, "Installing the MySQL Startup
30 Item" and Section 2.4.4, "Installing and Using the MySQL
31 Preference Pane," both of which simplify the management of
34 * Mac OS X server includes a version of MySQL as standard. If
35 you want to use a more recent version than that supplied with
36 the Mac OS X server release, you can make use of the package
37 or tar formats. For more information on using the MySQL
38 bundled with Mac OS X, see Section 2.4.5, "Using the Bundled
39 MySQL on Mac OS X Server."
41 For additional information on using MySQL on Mac OS X, see Section
42 2.4.1, "General Notes on Installing MySQL on Mac OS X."
44 2.4.1. General Notes on Installing MySQL on Mac OS X
46 You should keep the following issues and notes in mind:
48 * The default location for the MySQL Unix socket is different on
49 Mac OS X and Mac OS X Server depending on the installation
50 type you chose. The following table shows the default
51 locations by installation type.
52 Table 2.12. MySQL Unix Socket Locations on Mac OS X by
55 Installation Type Socket Location
56 Package Installer from MySQL /tmp/mysql.sock
57 Tarball from MySQL /tmp/mysql.sock
58 MySQL Bundled with Mac OS X Server /var/mysql/mysql.sock
59 To prevent issues, you should either change the configuration
60 of the socket used within your application (for example,
61 changing php.ini), or you should configure the socket location
62 using a MySQL configuration file and the socket option. For
63 more information, see Section 5.1.3, "Server Command Options."
65 * You may need (or want) to create a specific mysql user to own
66 the MySQL directory and data. On Mac OS X 10.4 and lower you
67 can do this by using the Netinfo Manager application, located
68 within the Utilities folder within the Applications folder. On
69 Mac OS X 10.5 and later you can do this through the Directory
70 Utility. From Mac OS X 10.5 and later (including Mac OS X
71 Server 10.5) the mysql should already exist. For use in single
72 user mode, an entry for _mysql (note the underscore prefix)
73 should already exist within the system /etc/passwd file.
75 * Due to a bug in the Mac OS X package installer, you may see
76 this error message in the destination disk selection dialog:
77 You cannot install this software on this disk. (null)
78 If this error occurs, click the Go Back button once to return
79 to the previous screen. Then click Continue to advance to the
80 destination disk selection again, and you should be able to
81 choose the destination disk correctly. We have reported this
82 bug to Apple and it is investigating this problem.
84 * If you get an "insecure startup item disabled" error when
85 MySQL launches, use the following procedure. Adjust the
86 pathnames appropriately for your system.
88 1. Modify the mysql.script using this command (enter it on a
90 shell> sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit
91 /usr/local/mysql/support-files/mysql.server
93 2. Locate the option file that defines the basedir value and
94 modify it to contain these lines:
95 basedir=/usr/local/mysql
96 datadir=/usr/local/mysql/data
97 In the /Library/StartupItems/MySQLCOM/ directory, make
98 the following group ID changes from staff to wheel:
99 shell> sudo chgrp wheel MySQLCOM StartupParameters.plist
101 3. Start the server from System Preferences or Terminal.app.
103 * Because the MySQL package installer installs the MySQL
104 contents into a version and platform specific directory, you
105 can use this to upgrade and migrate your database between
106 versions. You will need to either copy the data directory from
107 the old version to the new version, or alternatively specify
108 an alternative datadir value to set location of the data
111 * You might want to add aliases to your shell's resource file to
112 make it easier to access commonly used programs such as mysql
113 and mysqladmin from the command line. The syntax for bash is:
114 alias mysql=/usr/local/mysql/bin/mysql
115 alias mysqladmin=/usr/local/mysql/bin/mysqladmin
117 alias mysql /usr/local/mysql/bin/mysql
118 alias mysqladmin /usr/local/mysql/bin/mysqladmin
119 Even better, add /usr/local/mysql/bin to your PATH environment
120 variable. You can do this by modifying the appropriate startup
121 file for your shell. For more information, see Section 4.2.1,
122 "Invoking MySQL Programs."
124 * After you have copied over the MySQL database files from the
125 previous installation and have successfully started the new
126 server, you should consider removing the old installation
127 files to save disk space. Additionally, you should also remove
128 older versions of the Package Receipt directories located in
129 /Library/Receipts/mysql-VERSION.pkg.
131 2.4.2. Installing MySQL on Mac OS X Using Native Packages
133 You can install MySQL on Mac OS X 10.3.x ("Panther") or newer
134 using a Mac OS X binary package in DMG format instead of the
135 binary tarball distribution. Please note that older versions of
136 Mac OS X (for example, 10.1.x or 10.2.x) are not supported by this
139 The package is located inside a disk image (.dmg) file that you
140 first need to mount by double-clicking its icon in the Finder. It
141 should then mount the image and display its contents.
144 Before proceeding with the installation, be sure to stop all
145 running MySQL server instances by using either the MySQL Manager
146 Application (on Mac OS X Server) or mysqladmin shutdown on the
149 When installing from the package version, you should also install
150 the MySQL Preference Pane, which will enable you to control the
151 startup and execution of your MySQL server from System
152 Preferences. For more information, see Section 2.4.4, "Installing
153 and Using the MySQL Preference Pane."
155 When installing using the package installer, the files are
156 installed into a directory within /usr/local matching the name of
157 the installation version and platform. For example, the installer
158 file mysql-5.1.39-osx10.5-x86_64.pkg installs MySQL into
159 /usr/local/mysql-5.1.39-osx10.5-x86_64 . The following table shows
160 the layout of the installation directory.
162 Table 2.13. MySQL Installation Layout on Mac OS X
163 Directory Contents of Directory
164 bin Client programs and the mysqld server
165 data Log files, databases
166 docs Manual in Info format
167 include Include (header) files
169 man Unix manual pages
170 mysql-test MySQL test suite
171 scripts mysql_install_db
172 share Miscellaneous support files, including error messages,
173 sample configuration files, SQL for database installation
175 support-files Scripts and sample configuration files
176 /tmp/mysql.sock Location of the MySQL Unix socket
178 During the package installer process, a symbolic link from
179 /usr/local/mysql to the version/platform specific directory
180 created during installation will be created automatically.
182 1. Download and open the MySQL package installer, which is
183 provided on a disk image (.dmg) that includes the main MySQL
184 installation package, the MySQLStartupItem.pkg installation
185 package, and the MySQL.prefPane. Double-click the disk image
188 2. Double-click the MySQL installer package. It will be named
189 according to the version of MySQL you have downloaded. For
190 example, if you have downloaded MySQL 5.1.39, double-click
191 mysql-5.1.39-osx10.5-x86.pkg.
193 3. You will be presented with the opening installer dialog. Click
194 Continue to begin installation.
195 MySQL Package Installer: Step 1
197 4. A copy of the installation instructions and other important
198 information relevant to this installation are displayed. Click
201 5. If you have downloaded the community version of MySQL, you
202 will be shown a copy of the relevant GNU General Public
203 License. Click Continue .
205 6. Select the drive you want to use to install the MySQL Startup
206 Item. The drive must have a valid, bootable, Mac OS X
207 operating system installed. Click Continue.
208 MySQL Package Installer: Step 4
210 7. You will be asked to confirm the details of the installation,
211 including the space required for the installation. To change
212 the drive on which the startup item is installed, click either
213 Go Back or Change Install Location.... To install the startup
216 8. Once the installation has been completed successfully, you
217 will be shown an Install Succeeded message.
219 For convenience, you may also want to install the startup item and
220 preference pane. See Section 2.4.3, "Installing the MySQL Startup
221 Item," and Section 2.4.4, "Installing and Using the MySQL
224 2.4.3. Installing the MySQL Startup Item
226 The MySQL Installation Package includes a startup item that can be
227 used to automatically start and stop MySQL.
229 To install the MySQL Startup Item:
231 1. Download and open the MySQL package installer, which is
232 provided on a disk image (.dmg) that includes the main MySQL
233 installation package, the MySQLStartupItem.pkg installation
234 package, and the MySQL.prefPane. Double-click the disk image
237 2. Double-click the MySQLStartItem.pkg file to start the
238 installation process.
240 3. You will be presented with the Install MySQL Startup Item
242 MySQL Startup Item Installer: Step 1
243 Click Continue to continue the installation process.
245 4. A copy of the installation instructions and other important
246 information relevant to this installation are displayed. Click
249 5. Select the drive you want to use to install the MySQL Startup
250 Item. The drive must have a valid, bootable, Mac OS X
251 operating system installed. Click Continue.
252 MySQL Startup Item Installer: Step 3
254 6. You will be asked to confirm the details of the installation.
255 To change the drive on which the startup item is installed,
256 click either Go Back or Change Install Location.... To install
257 the startup item, click Install.
259 7. Once the installation has been completed successfully, you
260 will be shown an Install Succeeded message.
261 MySQL Startup Item Installer: Step 5
263 The Startup Item for MySQL is installed into
264 /Library/StartupItems/MySQLCOM. The Startup Item installation adds
265 a variable MYSQLCOM=-YES- to the system configuration file
266 /etc/hostconfig. If you want to disable the automatic startup of
267 MySQL, change this variable to MYSQLCOM=-NO-.
269 After the installation, you can start and stop MySQL by running
270 the following commands in a terminal window. You must have
271 administrator privileges to perform these tasks, and you may be
272 prompted for your password.
274 If you have installed the Startup Item, use this command to start
276 shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
278 If you have installed the Startup Item, use this command to stop
280 shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
282 2.4.4. Installing and Using the MySQL Preference Pane
284 The MySQL Package installer disk image also includes a custom
285 MySQL Preference Pane that enables you to start, stop, and control
286 automated startup during boot of your MySQL installation.
288 To install the MySQL Preference Pane:
290 1. Download and open the MySQL package installer package, which
291 is provided on a disk image (.dmg) that includes the main
292 MySQL installation package, the MySQLStartupItem.pkg
293 installation package, and the MySQL.prefPane. Double-click the
294 disk image to open it.
296 2. Double-click the MySQL.prefPane. The MySQL System Preferences
299 3. If this is the first time you have installed the preference
300 pane, you will be asked to confirm installation and whether
301 you want to install the preference pane for all users, or only
302 the current user. To install the preference pane for all users
303 you will need administrator privileges. If necessary, you will
304 be prompted for the username and password for a user with
305 administrator privileges.
307 4. If you already have the MySQL Preference Pane installed, you
308 will be asked to confirm whether you want to overwrite the
309 existing MySQL Preference Pane.
313 The MySQL Preference Pane only starts and stops MySQL installation
314 installed from the MySQL package installation that have been
315 installed in the default location.
317 Once the MySQL Preference Pane has been installed, you can control
318 your MySQL server instance using the preference pane. To use the
319 preference pane, open the System Preferences... from the Apple
320 menu. Select the MySQL preference pane by clicking the MySQL logo
321 within the Other section of the preference panes list.
322 MySQL Preference Pane
324 The MySQL Preference Pane shows the current status of the MySQL
325 server, showing stopped (in red) if the server is not running and
326 running (in green) if the server has already been started. The
327 preference pane also shows the current setting for whether the
328 MySQL server has been set to start automatically.
330 * To start MySQL using the preference pane:
331 Click Start MySQL Server. You may be prompted for the username
332 and password of a user with administrator privileges to start
335 * To stop MySQL using the preference pane:
336 Click Stop MySQL Server. You may be prompted for the username
337 and password of a user with administrator privileges to stop
340 * To automatically start the MySQL server when the system boots:
341 Check the check box next to Automatically Start MySQL Server
344 * To disable automatic MySQL server startup when the system
346 Uncheck the check box next to Automatically Start MySQL Server
349 You can close the System Preferences... window once you have
350 completed your settings.
352 2.4.5. Using the Bundled MySQL on Mac OS X Server
354 If you are running Mac OS X Server, a version of MySQL should
355 already be installed. The following table shows the versions of
356 MySQL that ship with Mac OS X Server versions.
358 Table 2.14. MySQL Versions Preinstalled with Mac OS X Server
359 Mac OS X Server Version MySQL Version
361 10.2.3-10.2.6 3.23.53
368 The following table shows the installation layout of MySQL on Mac
371 Table 2.15. MySQL Directory Layout for Preinstalled MySQL
372 Installations on Mac OS X Server
373 Directory Contents of Directory
374 /usr/bin Client programs
375 /var/mysql Log files, databases
376 /usr/libexec The mysqld server
377 /usr/share/man Unix manual pages
378 /usr/share/mysql/mysql-test MySQL test suite
379 /usr/share/mysql Miscellaneous support files, including error
380 messages, character set files, sample configuration files, SQL for
381 database installation
382 /var/mysql/mysql.sock Location of the MySQL Unix socket
387 * For more information on managing the bundled MySQL instance in
388 Mac OS X Server 10.5, see Mac OS X Server: Web Technologies
389 Administration For Version 10.5 Leopard
390 (http://images.apple.com/server/macosx/docs/Web_Technologies_A
393 * For more information on managing the bundled MySQL instance in
394 Mac OS X Server 10.6, see Mac OS X Server: Web Technologies
395 Administration Version 10.6 Snow Leopard
396 (http://manuals.info.apple.com/en_US/WebTech_v10.6.pdf).
398 * The MySQL server bundled with Mac OS X Server does not include
399 the MySQL client libraries and header files required to access
400 and use MySQL from a third-party driver, such as Perl DBI or
401 PHP. For more information on obtaining and installing MySQL
402 libraries, see Mac OS X Server version 10.5: MySQL libraries
403 available for download (http://support.apple.com/kb/TA25017).
404 Alternatively, you can ignore the bundled MySQL server and
405 install MySQL from the package or tarball installation.
407 Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights
408 reserved. Legal Notices