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-solaris10-PLATFORM.pkg.gz
file,
then decompress it. For example:
shell> gunzip mysql-5.5.9
-solaris10-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.5.9
-solaris10-x86_64.pkg
The following packages are available:
1 mysql MySQL Community Server (GPL)
(i86pc) 5.5.9
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.
The default installation directory is
/opt/mysql
. You can only change the root path
of the installation 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 the binary
tar
file.
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/S91mysql shell> 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 shutdown
shell> pkgrm mysql
shell> pkgadd -d mysql-5.5.9
-solaris10-x86_64.pkg
shell> mysql_upgrade
shell> mysqld_safe &
You should check the notes in Section 2.13, “Upgrading or Downgrading MySQL” before performing any upgrade.