Documentation Home
MySQL 5.6 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 30.1Mb
PDF (A4) - 30.3Mb
PDF (RPM) - 30.2Mb
EPUB - 7.8Mb
HTML Download (TGZ) - 7.6Mb
HTML Download (Zip) - 7.6Mb
HTML Download (RPM) - 6.6Mb
Eclipse Doc Plugin (TGZ) - 8.3Mb
Eclipse Doc Plugin (Zip) - 10.2Mb
Man Pages (TGZ) - 200.0Kb
Man Pages (Zip) - 311.5Kb
Info (Gzip) - 2.9Mb
Info (Zip) - 2.9Mb
Excerpts from this Manual

MySQL 5.6 Reference Manual  /  ...  /  Installing MySQL on Linux from the Native Software Repositories

2.5.7 Installing MySQL on Linux from the Native Software Repositories

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.


Native packages are often several versions behind the currently available release. You will also normally be unable to install development milestone releases (DMRs), as these are not usually made available in the native repositories. Before proceeding, we recommend that you check out the other installation options described in Section 2.5, “Installing MySQL on Linux”.

Distribution specific instructions are shown below:

  • Red Hat Linux, Fedora, CentOS


    For EL5, EL6, or EL7-based Linux platforms and Fedora 21, 22, or 23, you can install MySQL using the MySQL Yum repository instead of the platform's native software repository. See Section 2.5.1, “Installing MySQL on Linux Using the MySQL Yum Repository” for details.

    For Red Hat and similar distributions, the MySQL distribution is divided into a number of separate packages, mysql for the client tools, mysql-server for the server and associated tools, and mysql-libs for the libraries. The libraries are required if you want to provide connectivity from different languages and environments such as Perl, Python and others.

    To install, use the yum command to specify the packages that you want to install. For example:

    root-shell> yum install mysql mysql-server mysql-libs mysql-server
    Loaded plugins: presto, refresh-packagekit
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package mysql.x86_64 0:5.1.48-2.fc13 set to be updated
    ---> Package mysql-libs.x86_64 0:5.1.48-2.fc13 set to be updated
    ---> Package mysql-server.x86_64 0:5.1.48-2.fc13 set to be updated
    --> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5.1.48-2.fc13.x86_64
    --> Running transaction check
    ---> Package perl-DBD-MySQL.x86_64 0:4.017-1.fc13 set to be updated
    --> Finished Dependency Resolution
    Dependencies Resolved
     Package               Arch          Version               Repository      Size
     mysql                 x86_64        5.1.48-2.fc13         updates        889 k
     mysql-libs            x86_64        5.1.48-2.fc13         updates        1.2 M
     mysql-server          x86_64        5.1.48-2.fc13         updates        8.1 M
    Installing for dependencies:
     perl-DBD-MySQL        x86_64        4.017-1.fc13          updates        136 k
    Transaction Summary
    Install       4 Package(s)
    Upgrade       0 Package(s)
    Total download size: 10 M
    Installed size: 30 M
    Is this ok [y/N]: y
    Downloading Packages:
    Setting up and reading Presto delta metadata
    Processing delta metadata
    Package(s) data still to download: 10 M
    (1/4): mysql-5.1.48-2.fc13.x86_64.rpm                    | 889 kB     00:04
    (2/4): mysql-libs-5.1.48-2.fc13.x86_64.rpm               | 1.2 MB     00:06
    (3/4): mysql-server-5.1.48-2.fc13.x86_64.rpm             | 8.1 MB     00:40
    (4/4): perl-DBD-MySQL-4.017-1.fc13.x86_64.rpm            | 136 kB     00:00
    Total                                           201 kB/s |  10 MB     00:52
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Installing     : mysql-libs-5.1.48-2.fc13.x86_64                          1/4
      Installing     : mysql-5.1.48-2.fc13.x86_64                               2/4
      Installing     : perl-DBD-MySQL-4.017-1.fc13.x86_64                       3/4
      Installing     : mysql-server-5.1.48-2.fc13.x86_64                        4/4
      mysql.x86_64 0:5.1.48-2.fc13            mysql-libs.x86_64 0:5.1.48-2.fc13
      mysql-server.x86_64 0:5.1.48-2.fc13
    Dependency Installed:
      perl-DBD-MySQL.x86_64 0:4.017-1.fc13

    MySQL and the MySQL server should now be installed. A sample configuration file is installed into /etc/my.cnf. An init script, to start and stop the server, will have been installed into /etc/init.d/mysqld. To start the MySQL server use service:

    root-shell> service mysqld start

    To enable the server to be started and stopped automatically during boot, use chkconfig:

    root-shell> chkconfig --levels 235 mysqld on

    Which enables the MySQL server to be started (and stopped) automatically at the specified the run levels.

    The database tables will have been automatically created for you, if they do not already exist. You should, however, run mysql_secure_installation to set the root passwords on your server.

  • Debian, Ubuntu, Kubuntu


    For Debian 7 and 8, and Ubuntu 12, 14, and 15, MySQL can be installed using the MySQL APT Repository instead of the platform's native software repository. See Section 2.5.3, “Installing MySQL on Linux Using the MySQL APT Repository” for details.

    On Debian and related distributions, there are two packages for MySQL in their software repositories, mysql-client and mysql-server, for the client and server components respectively. You should specify an explicit version, for example mysql-client-5.1, to ensure that you install the version of MySQL that you want.

    To download and install, including any dependencies, use the apt-get command, specifying the packages that you want to install.


    Before installing, make sure that you update your apt-get index files to ensure you are downloading the latest available version.

    A sample installation of the MySQL packages might look like this (some sections trimmed for clarity):

    root-shell> apt-get install mysql-client-5.1 mysql-server-5.1
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following packages were automatically installed and are no longer required:
      linux-headers-2.6.28-11 linux-headers-2.6.28-11-generic
    Use 'apt-get autoremove' to remove them.
    The following extra packages will be installed:
      bsd-mailx libdbd-mysql-perl libdbi-perl libhtml-template-perl
      libmysqlclient15off libmysqlclient16 libnet-daemon-perl libplrpc-perl mailx
      mysql-common postfix
    Suggested packages:
      dbishell libipc-sharedcache-perl tinyca procmail postfix-mysql postfix-pgsql
      postfix-ldap postfix-pcre sasl2-bin resolvconf postfix-cdb
    The following NEW packages will be installed
      bsd-mailx libdbd-mysql-perl libdbi-perl libhtml-template-perl
      libmysqlclient15off libmysqlclient16 libnet-daemon-perl libplrpc-perl mailx
      mysql-client-5.1 mysql-common mysql-server-5.1 postfix
    0 upgraded, 13 newly installed, 0 to remove and 182 not upgraded.
    Need to get 1907kB/25.3MB of archives.
    After this operation, 59.5MB of additional disk space will be used.
    Do you want to continue [Y/n]? Y
    Get: 1 jaunty-updates/main mysql-common 5.1.30really5.0.75-0ubuntu10.5 [63.6kB]
    Get: 2 jaunty-updates/main libmysqlclient15off 5.1.30really5.0.75-0ubuntu10.5 [1843kB]
    Fetched 1907kB in 9s (205kB/s)
    Preconfiguring packages ...
    Selecting previously deselected package mysql-common.
    (Reading database ... 121260 files and directories currently installed.)
    Processing 1 added doc-base file(s)...
    Registering documents with scrollkeeper...
    Setting up libnet-daemon-perl (0.43-1) ...
    Setting up libplrpc-perl (0.2020-1) ...
    Setting up libdbi-perl (1.607-1) ...
    Setting up libmysqlclient15off (5.1.30really5.0.75-0ubuntu10.5) ...
    Setting up libdbd-mysql-perl (4.008-1) ...
    Setting up libmysqlclient16 (5.1.31-1ubuntu2) ...
    Setting up mysql-client-5.1 (5.1.31-1ubuntu2) ...
    Setting up mysql-server-5.1 (5.1.31-1ubuntu2) ...
     * Stopping MySQL database server mysqld
    100825 11:46:15  InnoDB: Started; log sequence number 0 46409
    100825 11:46:15  InnoDB: Starting shutdown...
    100825 11:46:17  InnoDB: Shutdown completed; log sequence number 0 46409
    100825 11:46:17 [Warning] Forcing shutdown of 1 plugins
     * Starting MySQL database server mysqld
     * Checking for corrupt, not cleanly closed and upgrade needing tables.
    Processing triggers for libc6 ...
    ldconfig deferred processing now taking place

    The apt-get command will install 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.

    During installation, the initial database will be created, and you will be prompted for the MySQL root password (and confirmation). A configuration file will have been created in /etc/mysql/my.cnf. An init script will have been created in /etc/init.d/mysql.

    The server will already be started. You can manually start and stop the server using:

    root-shell> service mysql [start|stop]

    The service will automatically be added to the 2, 3 and 4 run levels, with stop scripts in the single, shutdown and restart levels.

  • Gentoo Linux

    As a source-based distribution, installing MySQL on Gentoo involves downloading the source, patching the Gentoo specifics, and then compiling the MySQL server and installing it. This process is handled automatically by the emerge command. Depending on the version of MySQL that you want to install, you may need to unmask the specific version that you want for your chosen platform.

    The MySQL server and client tools are provided within a single package, dev-db/mysql. You can obtain a list of the versions available to install by looking at the portage directory for the package:

    root-shell> ls /usr/portage/dev-db/mysql/mysql-5.1*

    To install a specific MySQL version, you must specify the entire atom. For example:

    root-shell> emerge =dev-db/mysql-5.1.46

    A simpler alternative is to use the virtual/mysql-5.1 package, which will install the latest version:

    root-shell> emerge =virtual/mysql-5.1

    If the package is masked (because it is not tested or certified for the current platform), use the ACCEPT_KEYWORDS environment variable. For example:

    root-shell> ACCEPT_KEYWORDS="~x86" emerge =virtual/mysql-5.1

    After installation, you should create a new database using mysql_install_db, and set the password for the root user on MySQL. You can use the configuration interface to set the password and create the initial database:

    root-shell> emerge --config =dev-db/mysql-5.1.46

    A sample configuration file will have been created for you in /etc/mysql/my.cnf, and an init script will have been created in /etc/init.d/mysql.

    To enable MySQL to start automatically at the normal (default) run levels, you can use:

    root-shell> rc-update add mysql default

Download this Manual
PDF (US Ltr) - 30.1Mb
PDF (A4) - 30.3Mb
PDF (RPM) - 30.2Mb
EPUB - 7.8Mb
HTML Download (TGZ) - 7.6Mb
HTML Download (Zip) - 7.6Mb
HTML Download (RPM) - 6.6Mb
Eclipse Doc Plugin (TGZ) - 8.3Mb
Eclipse Doc Plugin (Zip) - 10.2Mb
Man Pages (TGZ) - 200.0Kb
Man Pages (Zip) - 311.5Kb
Info (Gzip) - 2.9Mb
Info (Zip) - 2.9Mb
User Comments
  Posted by David PROVOST on February 24, 2012
This is a MySQL 5.5 doc, explaining how to install MySQL 5.1 from "updates" repo on Centos-like distro. Easy.
Is there an alternative repo that you would recommand for 5.5 installation ?
  Posted by Nir Sagiv on December 3, 2012
  Posted by David Biesack on December 12, 2013
If you install a specific version such as MySQL 5.5 (via yum on RHEL, for example), the commands may be different:

yum install mysql55-mysql.x86_64 mysql55-mysql-server.x86_64

Do yum search mysql to see what packages are available.
Doing yum install mysql may install an older version, such as 5.0

Also, the command to start/stop the server may differ based on the package installed. For example if installing mysql55-mysql-server.x86_64 the server control command will be:

/etc/init.d/mysql55-mysqld status
/etc/init.d/mysql55-mysqld start
/etc/init.d/mysql55-mysqld stop
Sign Up Login You must be logged in to post a comment.