<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="file-permissions">
      </a>
      B.3.3.1 Problems with File Permissions
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045054131008">
  </a>
  <a class="indexterm" name="idm46045054129552">
  </a>
  <a class="indexterm" name="idm46045054128064">
  </a>
  <a class="indexterm" name="idm46045054126576">
  </a>
  <a class="indexterm" name="idm46045054125488">
  </a>
  <p>
   If you have problems with file permissions, the
   <code class="literal">
    UMASK
   </code>
   or
   <code class="literal">
    UMASK_DIR
   </code>
   environment variable might be set incorrectly when
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld
     </strong>
    </span>
   </a>
   starts. For example,
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld
     </strong>
    </span>
   </a>
   might issue the following error
          message when you create a table:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa5454200"><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-none">ERROR: Can't find file: 'path/with/<em class="replaceable">file_name</em>' (Errcode: 13)</code></pre>
  </div>
  <p>
   The default
   <code class="literal">
    UMASK
   </code>
   and
   <code class="literal">
    UMASK_DIR
   </code>
   values are
   <code class="literal">
    0640
   </code>
   and
   <code class="literal">
    0750
   </code>
   ,
          respectively.
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld
     </strong>
    </span>
   </a>
   assumes that the value
          for
   <code class="literal">
    UMASK
   </code>
   or
   <code class="literal">
    UMASK_DIR
   </code>
   is in octal if it starts with a zero. For example, setting
   <code class="literal">
    UMASK=0600
   </code>
   is equivalent to
   <code class="literal">
    UMASK=384
   </code>
   because 0600 octal is 384
          decimal.
  </p>
  <p>
   Assuming that you start
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld
     </strong>
    </span>
   </a>
   using
   <a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
    <span class="command">
     <strong>
      mysqld_safe
     </strong>
    </span>
   </a>
   , change the default
   <code class="literal">
    UMASK
   </code>
   value as follows:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa58372211"><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">UMASK<span class="token attr-value"><span class="token punctuation">=</span>384</span>  <span class="token comment" spellcheck="true"># = 600 in octal</span>
export UMASK
mysqld_safe &amp;</code></pre>
  </div>
  <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Note
   </div>
   <p>
    An exception applies for the error log file if you start
    <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
     <span class="command">
      <strong>
       mysqld
      </strong>
     </span>
    </a>
    using
    <a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
     <span class="command">
      <strong>
       mysqld_safe
      </strong>
     </span>
    </a>
    , which does not respect
    <code class="literal">
     UMASK
    </code>
    :
    <a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
     <span class="command">
      <strong>
       mysqld_safe
      </strong>
     </span>
    </a>
    may
            create the error log file if it does not exist prior to
            starting
    <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
     <span class="command">
      <strong>
       mysqld
      </strong>
     </span>
    </a>
    , and
    <a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
     <span class="command">
      <strong>
       mysqld_safe
      </strong>
     </span>
    </a>
    uses a umask set to a strict
            value of
    <code class="literal">
     0137
    </code>
    . If this is unsuitable,
            create the error file manually with the desired access mode
            prior to executing
    <a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
     <span class="command">
      <strong>
       mysqld_safe
      </strong>
     </span>
    </a>
    .
   </p>
  </div>
  <a class="indexterm" name="idm46045054095904">
  </a>
  <a class="indexterm" name="idm46045054094816">
  </a>
  <p>
   By default,
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld
     </strong>
    </span>
   </a>
   creates database
          directories with an access permission value of
   <code class="literal">
    0750
   </code>
   . To modify this behavior, set the
   <code class="literal">
    UMASK_DIR
   </code>
   variable. If you set its value,
          new directories are created with the combined
   <code class="literal">
    UMASK
   </code>
   and
   <code class="literal">
    UMASK_DIR
   </code>
   values. For example, to give group access to all new
          directories, start
   <a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
    <span class="command">
     <strong>
      mysqld_safe
     </strong>
    </span>
   </a>
   as follows:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa64823857"><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">UMASK_DIR<span class="token attr-value"><span class="token punctuation">=</span>504</span>  <span class="token comment" spellcheck="true"># = 770 in octal</span>
export UMASK_DIR
mysqld_safe &amp;</code></pre>
  </div>
  <p>
   For additional details, see
   <a class="xref" href="environment-variables.html" title="6.9 Environment Variables">
    Section 6.9, “Environment Variables”
   </a>
   .
  </p>
 </div>
 <br/>
</div>
