MySQL and Solaris/Installing MySQL on Solaris/ Installing MySQL on Solaris Using a Solaris PKG

2.1 Installing MySQL on Solaris Using a Solaris PKG

You can install MySQL on Solaris using a binary package of the native Solaris PKG format instead of the binary tarball distribution.

Important

The installation package has a dependency on the Oracle Developer Studio 12.6 Runtime Libraries, which must be installed before you run the MySQL installation package. See the download options for Oracle Developer Studiohere. The installation package enables you to install the runtime libraries only instead of the full Oracle Developer Studio; see instructions inInstalling Only the Runtime Libraries on Oracle Solaris 11.

来use this package, download the correspondingmysql-VERSION-solaris11-PLATFORM.pkg.gzfile, then uncompress it. For example:

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

来install a new package, usepkgaddand follow the onscreen prompts. You must have root privileges to perform this operation:

shell> pkgadd -d mysql-8.0.27-solaris11-x86_64.pkg The following packages are available: 1 mysql MySQL Community Server (GPL) (i86pc) 8.0.27 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 themysql_secure_installationscript 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 usingpkgadd, which can be used to install MySQL in a different Solaris zone. If you need to install in a specific directory, use a binarytarfile distribution.

Thepkginstaller 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

来remove MySQL, the installed package name ismysql. You can use this in combination with thepkgrmcommand to remove the installation.

来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-8.0.27-solaris11-x86_64.pkg shell> mysqld_safe & shell> mysql_upgrade # prior to MySQL 8.0.16 only

You should check the notes inUpgrading MySQLbefore performing any upgrade.