<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="solaris-installation-pkg">
      </a>
      2.7.1 Installing MySQL on Solaris Using a Solaris PKG
     </h3>
    </div>
   </div>
  </div>
  <p>
   You can install MySQL on Solaris using a binary package of the
      native Solaris PKG format instead of the binary tarball
      distribution.
  </p>
  <p>
   To use this package, download the corresponding
   <code class="filename">
    mysql-VERSION-solaris11-PLATFORM.pkg.gz
   </code>
   file,
      then uncompress it. For example:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa90292275"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$&gt; </span><span class="token command">gunzip</span> mysql-<em class="replaceable">8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>3</em>-solaris11-x86_64<span class="token punctuation">.</span>pkg<span class="token punctuation">.</span>gz</code></pre>
  </div>
  <p>
   To install a new package, use
   <span class="command">
    <strong>
     pkgadd
    </strong>
   </span>
   and follow
      the onscreen prompts. You must have root privileges to perform
      this operation:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa75409706"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$&gt; </span><span class="token command">pkgadd</span> <span class="token property">-d</span> mysql-<em class="replaceable">8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>3</em>-solaris11-x86_64<span class="token punctuation">.</span>pkg

The following packages are available<span class="token punctuation">:</span>
  1  mysql     MySQL Community Server <span class="token punctuation">(</span>GPL<span class="token punctuation">)</span>
               <span class="token punctuation">(</span>i86pc<span class="token punctuation">)</span> 8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>3

Select package<span class="token punctuation">(</span>s<span class="token punctuation">)</span> you wish to process <span class="token punctuation">(</span>or <span class="token atrule">'all'</span> to process
all packages<span class="token punctuation">)</span><span class="token punctuation">.</span> <span class="token punctuation">(</span>default<span class="token punctuation">:</span> all<span class="token punctuation">)</span> <span class="token punctuation">[</span>?<span class="token punctuation">,</span>??<span class="token punctuation">,</span>q<span class="token punctuation">]</span><span class="token punctuation">:</span></code></pre>
  </div>
  <p>
   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
   <a class="link" href="mysql-secure-installation.html" title="6.4.2 mysql_secure_installation — Improve MySQL Installation Security">
    <span class="command">
     <strong>
      mysql_secure_installation
     </strong>
    </span>
   </a>
   script that comes
      with the installation.
  </p>
  <p>
   By default, the PKG package installs MySQL under the root path
   <code class="filename">
    /opt/mysql
   </code>
   . You can change only the
      installation root path when using
   <span class="command">
    <strong>
     pkgadd
    </strong>
   </span>
   , which
      can be used to install MySQL in a different Solaris zone. If you
      need to install in a specific directory, use a binary
   <span class="command">
    <strong>
     tar
    </strong>
   </span>
   file distribution.
  </p>
  <p>
   The
   <code class="literal">
    pkg
   </code>
   installer copies a suitable startup
      script for MySQL into
   <code class="literal">
    /etc/init.d/mysql
   </code>
   . 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:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa39225034"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$&gt; </span><span class="token command">ln</span> /etc/init<span class="token punctuation">.</span>d/mysql /etc/rc3<span class="token punctuation">.</span>d/S91mysql
<span class="token prompt">$&gt; </span><span class="token command">ln</span> /etc/init<span class="token punctuation">.</span>d/mysql /etc/rc0<span class="token punctuation">.</span>d/K02mysql</code></pre>
  </div>
  <p>
   To remove MySQL, the installed package name is
   <code class="literal">
    mysql
   </code>
   . You can use this in combination with the
   <span class="command">
    <strong>
     pkgrm
    </strong>
   </span>
   command to remove the installation.
  </p>
  <p>
   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:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa56842580"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$&gt; </span><span class="token command">mysqladmin</span> shutdown
<span class="token prompt">$&gt; </span><span class="token command">pkgrm</span> mysql
<span class="token prompt">$&gt; </span><span class="token command">pkgadd</span> <span class="token property">-d</span> mysql-<em class="replaceable">8<span class="token punctuation">.</span>4<span class="token punctuation">.</span>3</em>-solaris11-x86_64<span class="token punctuation">.</span>pkg
<span class="token prompt">$&gt; </span><span class="token command">mysqld_safe</span> &amp;</code></pre>
  </div>
  <p>
   You should check the notes in
   <a class="xref" href="upgrading.html" title="Chapter 3 Upgrading MySQL">
    Chapter 3,
    <i>
     Upgrading MySQL
    </i>
   </a>
   before
      performing any upgrade.
  </p>
 </div>
 <br/>
</div>
