<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="starting-server">
      </a>
      2.9.2 Starting the Server
     </h3>
    </div>
   </div>
  </div>
  <div class="toc">
   <dl class="toc">
    <dt>
     <span class="section">
      <a href="starting-server-troubleshooting.html">
       2.9.2.1 Troubleshooting Problems Starting the MySQL Server
      </a>
     </span>
    </dt>
   </dl>
  </div>
  <p>
   This section describes how start the server on Unix and Unix-like
      systems. (For Windows, see
   <a class="xref" href="windows-server-first-start.html" title="2.3.3.5 Starting the Server for the First Time">
    Section 2.3.3.5, “Starting the Server for the First Time”
   </a>
   .) For some suggested
      commands that you can use to test whether the server is accessible
      and working properly, see
   <a class="xref" href="testing-server.html" title="2.9.3 Testing the Server">
    Section 2.9.3, “Testing the Server”
   </a>
   .
  </p>
  <p>
   Start the MySQL server like this if your installation includes
   <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 class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa88520975"><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">bin/mysqld_safe</span> <span class="token constant">--user</span><span class="token attr-value"><span class="token punctuation">=</span>mysql</span> &amp;</code></pre>
  </div>
  <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Note
   </div>
   <p>
    For Linux systems on which MySQL is installed using RPM
        packages, server startup and shutdown is managed using systemd
        rather than
    <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>
    , 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>
    is not installed. See
    <a class="xref" href="using-systemd.html" title="2.5.9 Managing MySQL Server with systemd">
     Section 2.5.9, “Managing MySQL Server with systemd”
    </a>
    .
   </p>
  </div>
  <p>
   Start the server like this if your installation includes systemd
      support:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa44517247"><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">systemctl</span> start mysqld</code></pre>
  </div>
  <p>
   Substitute the appropriate service name if it differs from
   <code class="literal">
    mysqld
   </code>
   (for example,
   <code class="literal">
    mysql
   </code>
   on SLES systems).
  </p>
  <p>
   It is important that the MySQL server be run using an unprivileged
      (non-
   <code class="literal">
    root
   </code>
   ) login account. To ensure this, run
   <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
   <code class="literal">
    root
   </code>
   and
      include the
   <a class="link" href="mysqld-safe.html#option_mysqld_safe_user">
    <code class="option">
     --user
    </code>
   </a>
   option as
      shown. Otherwise, you should execute the program while logged in
      as
   <code class="literal">
    mysql
   </code>
   , in which case you can omit the
   <a class="link" href="mysqld-safe.html#option_mysqld_safe_user">
    <code class="option">
     --user
    </code>
   </a>
   option from the
      command.
  </p>
  <p>
   For further instructions for running MySQL as an unprivileged
      user, see
   <a class="xref" href="changing-mysql-user.html" title="8.1.5 How to Run MySQL as a Normal User">
    Section 8.1.5, “How to Run MySQL as a Normal User”
   </a>
   .
  </p>
  <p>
   If the command fails immediately and prints
   <code class="literal">
    mysqld
      ended
   </code>
   , look for information in the error log (which by
      default is the
   <code class="filename">
    <em class="replaceable">
     <code>
      host_name
     </code>
    </em>
    .err
   </code>
   file
      in the data directory).
  </p>
  <p>
   If the server is unable to access the data directory it starts or
      read the grant tables in the
   <code class="literal">
    mysql
   </code>
   schema, it
      writes a message to its error log. Such problems can occur if you
      neglected to create the grant tables by initializing the data
      directory before proceeding to this step, or if you ran the
      command that initializes the data directory without the
   <code class="option">
    --user
   </code>
   option. Remove the
   <code class="filename">
    data
   </code>
   directory and run the command with the
   <code class="option">
    --user
   </code>
   option.
  </p>
  <p>
   If you have other problems starting the server, see
   <a class="xref" href="starting-server-troubleshooting.html" title="2.9.2.1 Troubleshooting Problems Starting the MySQL Server">
    Section 2.9.2.1, “Troubleshooting Problems Starting the MySQL Server”
   </a>
   . For more
      information about
   <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>
   , see
   <a class="xref" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
    Section 6.3.2, “mysqld_safe — MySQL Server Startup Script”
   </a>
   . For more information about systemd
      support, see
   <a class="xref" href="using-systemd.html" title="2.5.9 Managing MySQL Server with systemd">
    Section 2.5.9, “Managing MySQL Server with systemd”
   </a>
   .
  </p>
 </div>
 <br/>
</div>
