<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="selinux-context-mysqld-tcp-port">
      </a>
      8.7.5.1 Setting the TCP Port Context for mysqld
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045231553456">
  </a>
  <p>
   The default TCP port for
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld
     </strong>
    </span>
   </a>
   is
   <code class="literal">
    3306
   </code>
   ; and the SELinux context type used is
   <code class="literal">
    mysqld_port_t
   </code>
   .
  </p>
  <p>
   If you configure
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld
     </strong>
    </span>
   </a>
   to use a different
        TCP
   <a class="link" href="server-system-variables.html#sysvar_port">
    <code class="literal">
     port
    </code>
   </a>
   , you may need to set
        the context for the new port. For example to define the SELinux
        context for a non-default port such as port 3307:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa9684063"><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">semanage port <span class="token property">-a</span> <span class="token property">-t</span> mysqld_port_t <span class="token property">-p</span> tcp 3307</code></pre>
  </div>
  <p>
   To confirm that the port is added:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa76196335"><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">semanage</span> port <span class="token property">-l</span> | grep mysqld
mysqld_port_t                  tcp      3307<span class="token punctuation">,</span> 1186<span class="token punctuation">,</span> 3306<span class="token punctuation">,</span> 63132-63164</code></pre>
  </div>
 </div>
 <br/>
</div>
