# Installing MySQL on Solaris

MySQLMySQLi Database

MySQL can be installed on Solaris using a binary package which is the native Solaris PKG format, instead of using the binary tarball distribution. The installation package has a dependency on the Oracle Developer Studio 12.6 Runtime Libraries. This needs to be installed before running the MySQL installation package.

The installation package ensures that the runtime libraries only are installed, instead of having to install the full Oracle Developer Studio. This package can be used by downloading the corresponding mysql-VERSION-solaris11-PLATFORM.pkg.gz file.

## Uncompress Solaris Package

This needs to be uncompressed after being downloaded. Below is a sample code to do the same −

shell> gunzip mysql-8.0.25-solaris11-x86_64.pkg.gz

## Install New Package

If a new package needs to be installed, the ‘pkgadd’ option has to be used and the onscreen prompts need to be followed.

In addition to this, the user must have the root privileges to perform this operation.

shell> pkgadd -d mysql-8.0.25-solaris11-x86_64.pkg
The following packages are available:
1 mysql MySQL Community Server (GPL)
(i86pc) 8.0.25
Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]:

The PKG installer installs all the files and tools that are needed, and initializes the database as well (if it doesn’t exist).

To complete the installation, the root password for MySQL has to be set based on the instructions provided at the end of the installation. Otherwise, there is another way to do this- The ‘mysql_secure_installation’ script has to be run, which comes with the installation.

By default, the PKG package installs MySQL under the root path, i.e /opt/mysql. The installation root path can be changed only if ‘pkgadd’ is used. This can be used to install MySQL in a different zone of Solaris.

## Safe startup and shutdown

If MySQL needs to be automatically enabled during startup and closed when the system is shut down, a link needs to be created between this file and the ‘init’ script directories.

To ensure safe startup and shutdown of MySQL, the below commands can be added to the correct links.

shell> ln /etc/init.d/mysql /etc/rc3.d/S91mysql
shell> ln /etc/init.d/mysql /etc/rc0.d/K02mysql

If Solaris package file format needs to be upgraded, the existing installation of the package needs to be removed before installing the updated package. When the package is removed, it doesn’t delete the existing information on the database. It just deletes the server, binaries and the support file.

Published on 08-Mar-2021 11:52:50