<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="linux-installation-native">
      </a>
      2.5.7 Installing MySQL on Linux from the Native Software Repositories
     </h3>
    </div>
   </div>
  </div>
  <p>
   Many Linux distributions include a version of the MySQL server,
      client tools, and development components in their native software
      repositories and can be installed with the platforms' standard
      package management systems. This section provides basic
      instructions for installing MySQL using those package management
      systems.
  </p>
  <div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Important
   </div>
   <p>
    Native packages are often several versions behind the currently
        available release. You are also normally unable to install
        development milestone releases (DMRs), since these are not
        usually made available in the native repositories. Before
        proceeding, we recommend that you check out the other
        installation options described in
    <a class="xref" href="linux-installation.html" title="2.5 Installing MySQL on Linux">
     Section 2.5, “Installing MySQL on Linux”
    </a>
    .
   </p>
  </div>
  <p>
   Distribution specific instructions are shown below:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <span class="bold">
       <strong>
        Red Hat Linux, Fedora, CentOS
       </strong>
      </span>
     </p>
     <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
      <div class="admon-title">
       Note
      </div>
      <p>
       For a number of Linux distributions, you can install MySQL
            using the MySQL Yum repository instead of the platform's
            native software repository. See
       <a class="xref" href="linux-installation-yum-repo.html" title="2.5.1 Installing MySQL on Linux Using the MySQL Yum Repository">
        Section 2.5.1, “Installing MySQL on Linux Using the MySQL Yum Repository”
       </a>
       for details.
      </p>
     </div>
     <p>
      For Red Hat and similar distributions, the MySQL distribution
          is divided into a number of separate packages,
      <code class="literal">
       mysql
      </code>
      for the client tools,
      <code class="literal">
       mysql-server
      </code>
      for the server and associated
          tools, and
      <code class="literal">
       mysql-libs
      </code>
      for the libraries.
          The libraries are required if you want to provide connectivity
          from different languages and environments such as Perl, Python
          and others.
     </p>
     <p>
      To install, use the
      <span class="command">
       <strong>
        yum
       </strong>
      </span>
      command to specify
          the packages that you want to install. For example:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa89044246"><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">yum</span> install mysql mysql-server mysql-libs mysql-server
Loaded plugins<span class="token punctuation">:</span> presto<span class="token punctuation">,</span> refresh-packagekit
Setting up Install Process
Resolving Dependencies
<span class="token property">--&gt;</span> Running transaction check
<span class="token property">---&gt;</span> Package mysql<span class="token punctuation">.</span>x86_64 0<span class="token punctuation">:</span>5<span class="token punctuation">.</span>1<span class="token punctuation">.</span>48-2<span class="token punctuation">.</span>fc13 set to be updated
<span class="token property">---&gt;</span> Package mysql-libs<span class="token punctuation">.</span>x86_64 0<span class="token punctuation">:</span>5<span class="token punctuation">.</span>1<span class="token punctuation">.</span>48-2<span class="token punctuation">.</span>fc13 set to be updated
<span class="token property">---&gt;</span> Package mysql-server<span class="token punctuation">.</span>x86_64 0<span class="token punctuation">:</span>5<span class="token punctuation">.</span>1<span class="token punctuation">.</span>48-2<span class="token punctuation">.</span>fc13 set to be updated
<span class="token property">--&gt;</span> Processing Dependency<span class="token punctuation">:</span> perl-DBD-MySQL for package<span class="token punctuation">:</span> mysql-server-5<span class="token punctuation">.</span>1<span class="token punctuation">.</span>48-2<span class="token punctuation">.</span>fc13<span class="token punctuation">.</span>x86_64
<span class="token property">--&gt;</span> Running transaction check
<span class="token property">---&gt;</span> Package perl-DBD-MySQL<span class="token punctuation">.</span>x86_64 0<span class="token punctuation">:</span>4<span class="token punctuation">.</span>017-1<span class="token punctuation">.</span>fc13 set to be updated
<span class="token property">--&gt;</span> Finished Dependency Resolution

Dependencies Resolved

<span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span></span>
 Package               Arch          Version               Repository      Size
<span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span></span>
Installing<span class="token punctuation">:</span>
 mysql                 x86_64        5<span class="token punctuation">.</span>1<span class="token punctuation">.</span>48-2<span class="token punctuation">.</span>fc13         updates        889 k
 mysql-libs            x86_64        5<span class="token punctuation">.</span>1<span class="token punctuation">.</span>48-2<span class="token punctuation">.</span>fc13         updates        1<span class="token punctuation">.</span>2 M
 mysql-server          x86_64        5<span class="token punctuation">.</span>1<span class="token punctuation">.</span>48-2<span class="token punctuation">.</span>fc13         updates        8<span class="token punctuation">.</span>1 M
Installing for dependencies<span class="token punctuation">:</span>
 perl-DBD-MySQL        x86_64        4<span class="token punctuation">.</span>017-1<span class="token punctuation">.</span>fc13          updates        136 k

Transaction Summary
<span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span><span class="token punctuation">=</span></span>
Install       4 Package<span class="token punctuation">(</span>s<span class="token punctuation">)</span>
Upgrade       0 Package<span class="token punctuation">(</span>s<span class="token punctuation">)</span>

Total download size<span class="token punctuation">:</span> 10 M
Installed size<span class="token punctuation">:</span> 30 M
Is this ok <span class="token punctuation">[</span>y/N<span class="token punctuation">]</span><span class="token punctuation">:</span> y
Downloading Packages<span class="token punctuation">:</span>
Setting up and reading Presto delta metadata
Processing delta metadata
Package<span class="token punctuation">(</span>s<span class="token punctuation">)</span> data still to download<span class="token punctuation">:</span> 10 M
<span class="token punctuation">(</span>1/4<span class="token punctuation">)</span><span class="token punctuation">:</span> mysql-5<span class="token punctuation">.</span>1<span class="token punctuation">.</span>48-2<span class="token punctuation">.</span>fc13<span class="token punctuation">.</span>x86_64<span class="token punctuation">.</span>rpm                    | 889 kB     00<span class="token punctuation">:</span>04
<span class="token punctuation">(</span>2/4<span class="token punctuation">)</span><span class="token punctuation">:</span> mysql-libs-5<span class="token punctuation">.</span>1<span class="token punctuation">.</span>48-2<span class="token punctuation">.</span>fc13<span class="token punctuation">.</span>x86_64<span class="token punctuation">.</span>rpm               | 1<span class="token punctuation">.</span>2 MB     00<span class="token punctuation">:</span>06
<span class="token punctuation">(</span>3/4<span class="token punctuation">)</span><span class="token punctuation">:</span> mysql-server-5<span class="token punctuation">.</span>1<span class="token punctuation">.</span>48-2<span class="token punctuation">.</span>fc13<span class="token punctuation">.</span>x86_64<span class="token punctuation">.</span>rpm             | 8<span class="token punctuation">.</span>1 MB     00<span class="token punctuation">:</span>40
<span class="token punctuation">(</span>4/4<span class="token punctuation">)</span><span class="token punctuation">:</span> perl-DBD-MySQL-4<span class="token punctuation">.</span>017-1<span class="token punctuation">.</span>fc13<span class="token punctuation">.</span>x86_64<span class="token punctuation">.</span>rpm            | 136 kB     00<span class="token punctuation">:</span>00
<span class="token property">--------------------------------------------------------------------------------</span>
Total                                           201 kB/s |  10 MB     00<span class="token punctuation">:</span>52
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     <span class="token punctuation">:</span> mysql-libs-5<span class="token punctuation">.</span>1<span class="token punctuation">.</span>48-2<span class="token punctuation">.</span>fc13<span class="token punctuation">.</span>x86_64                          1/4
  Installing     <span class="token punctuation">:</span> mysql-5<span class="token punctuation">.</span>1<span class="token punctuation">.</span>48-2<span class="token punctuation">.</span>fc13<span class="token punctuation">.</span>x86_64                               2/4
  Installing     <span class="token punctuation">:</span> perl-DBD-MySQL-4<span class="token punctuation">.</span>017-1<span class="token punctuation">.</span>fc13<span class="token punctuation">.</span>x86_64                       3/4
  Installing     <span class="token punctuation">:</span> mysql-server-5<span class="token punctuation">.</span>1<span class="token punctuation">.</span>48-2<span class="token punctuation">.</span>fc13<span class="token punctuation">.</span>x86_64                        4/4

Installed<span class="token punctuation">:</span>
  mysql<span class="token punctuation">.</span>x86_64 0<span class="token punctuation">:</span>5<span class="token punctuation">.</span>1<span class="token punctuation">.</span>48-2<span class="token punctuation">.</span>fc13            mysql-libs<span class="token punctuation">.</span>x86_64 0<span class="token punctuation">:</span>5<span class="token punctuation">.</span>1<span class="token punctuation">.</span>48-2<span class="token punctuation">.</span>fc13
  mysql-server<span class="token punctuation">.</span>x86_64 0<span class="token punctuation">:</span>5<span class="token punctuation">.</span>1<span class="token punctuation">.</span>48-2<span class="token punctuation">.</span>fc13

Dependency Installed<span class="token punctuation">:</span>
  perl-DBD-MySQL<span class="token punctuation">.</span>x86_64 0<span class="token punctuation">:</span>4<span class="token punctuation">.</span>017-1<span class="token punctuation">.</span>fc13

Complete!</code></pre>
     </div>
     <p>
      MySQL and the MySQL server should now be installed. A sample
          configuration file is installed into
      <code class="filename">
       /etc/my.cnf
      </code>
      . To start the MySQL server
          use
      <span class="command">
       <strong>
        systemctl
       </strong>
      </span>
      :
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa2983937"><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>
      The database tables are automatically created for you, if they
          do not already exist. You should, however, run
      <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>
      to set the root
          passwords on your server.
     </p>
    </li>
    <li class="listitem">
     <p>
      <span class="bold">
       <strong>
        Debian, Ubuntu, Kubuntu
       </strong>
      </span>
     </p>
     <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
      <div class="admon-title">
       Note
      </div>
      <p>
       For supported Debian and Ubuntu versions, MySQL can be
            installed using the
       <a class="ulink" href="https://dev.mysql.com/downloads/repo/apt/" target="_top">
        MySQL APT
            Repository
       </a>
       instead of the platform's native software
            repository. See
       <a class="xref" href="linux-installation-apt-repo.html" title="2.5.2 Installing MySQL on Linux Using the MySQL APT Repository">
        Section 2.5.2, “Installing MySQL on Linux Using the MySQL APT Repository”
       </a>
       for details.
      </p>
     </div>
     <p>
      On Debian and related distributions, there are two packages
          for MySQL in their software repositories,
      <code class="literal">
       mysql-client
      </code>
      and
      <code class="literal">
       mysql-server
      </code>
      , for the client and server
          components respectively. You should specify an explicit
          version, for example
      <code class="literal">
       mysql-client-5.1
      </code>
      , to
          ensure that you install the version of MySQL that you want.
     </p>
     <p>
      To download and install, including any dependencies, use the
      <span class="command">
       <strong>
        apt-get
       </strong>
      </span>
      command, specifying the packages
          that you want to install.
     </p>
     <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
      <div class="admon-title">
       Note
      </div>
      <p>
       Before installing, make sure that you update your
       <code class="literal">
        apt-get
       </code>
       index files to ensure you are
            downloading the latest available version.
      </p>
     </div>
     <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
      <div class="admon-title">
       Note
      </div>
      <p>
       The
       <span class="command">
        <strong>
         apt-get
        </strong>
       </span>
       command installs a number of
            packages, including the MySQL server, in order to provide
            the typical tools and application environment. This can mean
            that you install a large number of packages in addition to
            the main MySQL package.
      </p>
     </div>
     <p>
      During installation, the initial database is created, and you
          are prompted for the MySQL root password (and confirmation). A
          configuration file is created in
      <code class="filename">
       /etc/mysql/my.cnf
      </code>
      . An init script is
          created in
      <code class="filename">
       /etc/init.d/mysql
      </code>
      .
     </p>
     <p>
      The server should already be started. You can manually start
          and stop the server using:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa22286223"><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">service</span> mysql <span class="token punctuation">[</span>start|stop<span class="token punctuation">]</span></code></pre>
     </div>
     <p>
      The service is automatically added to the 2, 3 and 4 run
          levels, with stop scripts in the single, shutdown and restart
          levels.
     </p>
    </li>
   </ul>
  </div>
 </div>
 <br/>
</div>
