Table of Contents
MySQL on Solaris and OpenSolaris is available in a number of different formats.
For information on installing using the native Solaris PKG format, see Section 2.1, “Installing MySQL on Solaris Using a Solaris PKG”.
On OpenSolaris, the standard package repositories include MySQL packages specially built for OpenSolaris that include entries for the Service Management Framework (SMF) to enable control of the installation using the SMF administration commands. For more information, see Section 2.2, “Installing MySQL on OpenSolaris Using IPS”.
To use a standard tar binary installation,
use the notes provided in Chapter 1, Installing MySQL on Unix/Linux Using Generic Binaries.
Check the notes and hints at the end of this section for Solaris
specific notes that you may need before or after installation.
To obtain a binary MySQL distribution for Solaris in tarball or PKG format, http://dev.mysql.com/downloads/mysql/5.7.html.
Additional notes to be aware of when installing and using MySQL on Solaris:
If you want to use MySQL with the mysql user
and group, use the groupadd and
useradd commands:
groupadd mysql useradd -g mysql -s /bin/false mysql
If you install MySQL using a binary tarball distribution on Solaris, you may run into trouble even before you get the MySQL distribution unpacked, as the Solaris tar cannot handle long file names. This means that you may see errors when you try to unpack MySQL.
If this occurs, you must use GNU tar
(gtar) to unpack the distribution. In Solaris
10 and OpenSolaris gtar is normally located
in /usr/sfw/bin/gtar, but may not be
included in the default path definition.
When using Solaris 10 for x86_64, you should mount any file
systems on which you intend to store InnoDB
files with the forcedirectio option. (By
default mounting is done without this option.) Failing to do so
will cause a significant drop in performance when using the
InnoDB storage engine on this platform.
If you would like MySQL to start automatically, you can copy
support-files/mysql.server to
/etc/init.d and create a symbolic link to
it named /etc/rc3.d/S99mysql.server.
If too many processes try to connect very rapidly to mysqld, you should see this error in the MySQL log:
Error in accept: Protocol error
You might try starting the server with the
--back_log=50 option as a
workaround for this.
To configure the generation of core files on Solaris you should
use the coreadm command. Because of the
security implications of generating a core on a
setuid() application, by default, Solaris
does not support core files on setuid()
programs. However, you can modify this behavior using
coreadm. If you enable
setuid() core files for the current user,
they will be generated using the mode 600 and owned by the
superuser.
You can install MySQL on Solaris and OpenSolaris using a binary package using the native Solaris PKG format instead of the binary tarball distribution.
To use this package, download the corresponding
mysql-VERSION-solaris11-PLATFORM.pkg.gz file,
then uncompress it. For example:
shell> gunzip mysql-5.7.16-solaris11-x86_64.pkg.gz
To install a new package, use pkgadd and follow the onscreen prompts. You must have root privileges to perform this operation:
shell> pkgadd -d mysql-5.7.16-solaris11-x86_64.pkg
The following packages are available:
1 mysql MySQL Community Server (GPL)
(i86pc) 5.7.16
Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]:
The PKG installer installs all of the files and tools needed, and then initializes your database if one does not exist. To complete the installation, you should set the root password for MySQL as provided in the instructions at the end of the installation. Alternatively, you can run the mysql_secure_installation script that comes with the installation.
By default, the PKG package installs MySQL under the root path
/opt/mysql. You can change only the
installation root path when using pkgadd, which
can be used to install MySQL in a different Solaris zone. If you
need to install in a specific directory, use a binary
tar file distribution.
The pkg installer copies a suitable startup
script for MySQL into /etc/init.d/mysql. To
enable MySQL to startup and shutdown automatically, you should
create a link between this file and the init script directories.
For example, to ensure safe startup and shutdown of MySQL you
could use the following commands to add the right links:
shell>ln /etc/init.d/mysql /etc/rc3.d/S91mysqlshell>ln /etc/init.d/mysql /etc/rc0.d/K02mysql
To remove MySQL, the installed package name is
mysql. You can use this in combination with the
pkgrm command to remove the installation.
To upgrade when using the Solaris package file format, you must remove the existing installation before installing the updated package. Removal of the package does not delete the existing database information, only the server, binaries and support files. The typical upgrade sequence is therefore:
shell>mysqladmin shutdownshell>pkgrm mysqlshell>pkgadd -d mysql-shell>5.7.16-solaris11-x86_64.pkgmysqld_safe &shell>mysql_upgrade
You should check the notes in Upgrading or Downgrading MySQL before performing any upgrade.
OpenSolaris includes standard packages for MySQL in the core
repository. The MySQL packages are based on a specific release of
MySQL and updated periodically. For the latest release you must
use either the native Solaris PKG, tar, or
source installations. The native OpenSolaris packages include SMF
files so that you can easily control your MySQL installation,
including automatic startup and recovery, using the native service
management tools.
To install MySQL on OpenSolaris, use the pkg command. You will need to be logged in as root, or use the pfexec tool, as shown in the example below:
shell> pfexec pkg install SUNWmysql57
The package set installs three individual packages,
SUNWmysql57lib, which
contains the MySQL client libraries;
SUNWmysql57r which contains
the root components, including SMF and configuration files; and
SUNWmysql57u which contains
the scripts, binary tools and other files. You can install these
packages individually if you only need the corresponding
components.
The MySQL files are installed into /usr/mysql
which symbolic links for the sub directories
(bin, lib, etc.) to a
version specific directory. For MySQL 5.7, the full
installation is located in
/usr/mysql/5.7. The default data
directory is
/var/mysql/5.7/data. The
configuration file is installed in
/etc/mysql/5.7/my.cnf. This
layout permits multiple versions of MySQL to be installed, without
overwriting the data and binaries from other versions.
Once installed, you must initialize the data directory (see Initializing the Data Directory), and use the mysql_secure_installation to secure your installation.
Once installed, you can start and stop your MySQL server using the
installed SMF configuration. The service name is
mysql, or if you have multiple versions
installed, you should use the full version name, for example
mysql:version_57. To start
and enable MySQL to be started at boot time:
shell> svcadm enable mysql
To view the SMF logs, use this command:
shell> svcadm enable svc:/application/database/mysql
To check whether the MySQL service is running:
shell> svcs -xv
svc:/application/database/mysql
To disable MySQL from starting during boot time, and shut the MySQL server down if it is running:
shell> svcadm disable mysql
To restart MySQL, for example after a configuration file changes,
use the restart option:
shell> svcadm restart mysql
You can also use SMF to configure the data directory and enable full 64-bit mode. For example, to set the data directory used by MySQL:
shell>svccfgsvc:>select mysql:version_57svc:/application/database/mysql:version_57> setprop mysql/data=/data0/mysql
By default, the 32-bit binaries are used. To enable the 64-bit
server on 64-bit platforms, set the
enable_64bit parameter. For example:
svc:/application/database/mysql:version_57> setprop mysql/enable_64bit=1
You must refresh the SMF after setting these options:
shell> svcadm refresh mysql