Oracle provides a set of binary distributions of MySQL. These
include binary distributions in the form of compressed
tar files (files with a
.tar.gz extension) for a number of platforms,
as well as binaries in platform-specific package formats for
This section covers the installation of MySQL from a compressed tar file binary distribution. For other platform-specific package formats, see the other platform-specific sections. For example, for Windows distributions, see Section 2.3, “Installing MySQL on Microsoft Windows”.
To obtain MySQL, see Section 2.1.3, “How to Get MySQL”.
MySQL compressed tar file binary distributions
have names of the form
number (for example,
OS indicates the type of operating system
for which the distribution is intended (for example,
To install MySQL from a compressed tar file
binary distribution, your system must have GNU
gunzip to uncompress the distribution and a
reasonable tar to unpack it. If your
tar program supports the
option, it can both uncompress and unpack the file.
GNU tar is known to work. The standard
tar provided with some operating systems is not
able to unpack the long file names in the MySQL distribution. You
should download and install GNU tar, or if
available, use a preinstalled version of GNU tar. Usually this is
available as gnutar, gtar, or
as tar within a GNU or Free Software directory,
/usr/local/bin. GNU tar is
available from http://www.gnu.org/software/tar/.
If you run into problems and need to file a bug report, please use the instructions in Section 1.8, “How to Report Bugs or Problems”.
To install and use a MySQL binary distribution, the basic command sequence looks like this:
useradd -r -g mysql mysqlshell>
chown -R mysql .shell>
chgrp -R mysql .shell>
chown -R root .shell>
chown -R mysql datashell>
small/etc/my.cnf # Optional
bin/mysqld_safe --user=mysql &shell>
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql.server # Optional
For versions of MySQL older than 4.0, substitute bin/safe_mysqld for bin/mysqld_safe.
A more detailed version of the preceding description for installing a binary distribution follows.
This procedure assumes that you have
(administrator) access to your system. Alternatively, you can
prefix each command using the sudo (Linux) or
pfexec (OpenSolaris) command.
The procedure does not set up any passwords for MySQL accounts. After following the procedure, proceed to Section 2.10, “Postinstallation Setup and Testing”.
If your system does not already have a user and group for
mysqld to run as, you may need to create one. The
following commands add the
mysql group and the
mysql user. The syntax for
useradd and groupadd may
differ slightly on different versions of Unix, or they may have
different names such as adduser and
useradd -r -g mysql mysql
Because the user is required only for ownership purposes, not
login purposes, the useradd command uses the
-r option to create a user that does not have
login permissions to your server. Omit this option to permit
logins for the user (or if your useradd does
not support the option).
You might want to call the user and group something else instead of
mysql. If so, substitute the appropriate name in
the preceding commands and in the following steps.
Pick the directory under which you want to unpack the distribution
and change location into it. The example here unpacks the
instructions, therefore, assume that you have permission to create
files and directories in
/usr/local. If that
directory is protected, you must perform the installation as
Obtain a distribution file using the instructions in Section 2.1.3, “How to Get MySQL”. For a given release, binary distributions for all platforms are built from the same MySQL source distribution.
Unpack the distribution, which creates the installation directory.
Then create a symbolic link to that directory.
tar can uncompress and unpack the distribution if
z option support:
The tar command creates a directory named
ln command makes a symbolic link to that
directory. This enables you to refer more easily to the installation
If your tar does not have
option support, use gunzip to unpack the
distribution and tar to unpack it. Replace the
preceding tar command with the following
alternative command to uncompress and extract the distribution:
/path/to/mysql-VERSION-OS.tar.gz | tar xvf -
The remainder of the installation process involves setting up the configuration file, creating the core databases, and starting the MySQL server. For instructions, see Section 2.10, “Postinstallation Setup and Testing”.
The accounts that are listed in the MySQL grant tables initially have no passwords. After starting the server, you should set up passwords for them using the instructions in Section 2.10, “Postinstallation Setup and Testing”.