Documentation Home
MySQL 5.6 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 28.7Mb
PDF (A4) - 28.7Mb
Man Pages (TGZ) - 189.1Kb
Man Pages (Zip) - 302.1Kb
Info (Gzip) - 2.8Mb
Info (Zip) - 2.8Mb
Excerpts from this Manual

MySQL 5.6 Reference Manual  /  ...  /  Installing MySQL on Linux Using RPM Packages from Oracle

2.5.5 Installing MySQL on Linux Using RPM Packages from Oracle

The recommended way to install MySQL on RPM-based Linux distributions is by using the RPM packages provided by Oracle. There are two sources for obtaining them, for the Community Edition of MySQL:


RPM distributions of MySQL are also provided by other vendors. Be aware that they may differ from those built by Oracle in features, capabilities, and conventions (including communication setup), and that the installation instructions in this manual do not necessarily apply to them. The vendor's instructions should be consulted instead.

If you have such a third-party distribution of MySQL running on your system and now want to migrate to Oracle's distribution using the RPM packages downloaded from the MySQL Developer Zone, see Compatibility with RPM Packages from Other Vendors below. The preferred method of migration, however, is to use the MySQL Yum repository or MySQL SLES repository.

There are two kinds of RPM packages for installing MySQL 5.6 :

  • The older kind: Their package names started with MYSQL- . They are available from the MySQL Downloads page in the MySQL Developer Zone. The instructions given in this section are for using these packages.

  • The newer kind: Their package names started with mysql-community- or mysql-commercial-. They are available from the MySQL Yum repository and MySQL SLES repository. If, instead of configuring your system to install these RPM directly from the MySQL repositories (which is recommended), you are downloading the packages from the repositories and then installing them manually in separate steps, use the installation commands given for the MySQL 5.7 RPMs in Installing MySQL on Linux Using RPM Packages from Oracle, but consult this section for information like installation layout, server initialization, root password, and so on.

RPM packages for MySQL are listed in the following tables:

Table 2.9 RPM Packages for MySQL Community Edition

Package Name Summary
MySQL-server Database server and related tools
MySQL-client MySQL client applications and tools
MySQL-devel Development header files and libraries for MySQL database client applications
MySQL-shared Shared libraries for MySQL database client applications
MySQL-shared-compat Shared compatibility libraries for previous MySQL installations
MySQL-embedded MySQL embedded library
MySQL-test Test suite for the MySQL server

Dependency relationships exist among some of the packages. If you plan to install many of the packages, you may wish to download the RPM bundle tar file instead, which contains all the RPM packages listed above, so that you need not download them separately.

The full names for the RPMs have the following syntax:


The distribution and arch values indicate the Linux distribution and the processor type for which the package was built. See the table below for lists of the distribution identifiers:

Table 2.10 MySQL Linux RPM Package Distribution Identifiers

distribution Value Intended Use
el6, el7 Red Hat Enterprise Linux/Oracle Linux/CentOS 5, 6, or 7
sles11, sles12 SUSE Linux Enterprise Server 11 or 12
linux_glibc2.5 Distribution independent; run on any RPM-based Linux distribution

To see all files in an RPM package (for example, MySQL-server), use the following command:

$> rpm -qpl MySQL-server-version-distribution-arch.rpm

In most cases, you need to install the MySQL-server and MySQL-client to get a functional, standard MySQL installation. To perform such a standard, minimal installation, go to the folder that contains all those packages (and, preferably, no other RPM packages with similar names), and issue the following command (replace yum with zypper for SLES systems):

$> yum install MySQL-{server,client}-*

While it is much preferable to use a high-level package management tool like yum to install the packages, users who prefer direct rpm commands can replace the yum install command with the rpm -Uvh command; however, using rpm -Uvh instead makes the installation process more prone to failure, due to potential dependency issues the installation process might run into.

To install only the client programs, you can skip installing the MySQL-server package; issue the following command (replace yum with zypper for SLES systems):

$> yum install MySQL-client-*

A standard installation of MySQL using the RPM packages result in files and resources created under the system directories, shown in the following table.

Table 2.11 MySQL Installation Layout for Linux RPM Packages from the MySQL Developer Zone

Files or Resources Location
Client programs and scripts /usr/bin
mysqld server /usr/sbin
Data directory /var/lib/mysql
Error log file

For RHEL, Oracle Linux, or CentOS: /var/lib/mysql/host_name.err

For SLES: /var/log/mysql/mysqld.log

System V init script


Systemd service


Pid file


Unix manual pages /usr/share/man
Include (header) files /usr/include/mysql
Libraries /usr/lib/mysql
Socket /var/lib/mysql/mysql.sock
Miscellaneous support files (for example, error messages, and character set files) /usr/share/mysql

The installation also creates a user named mysql and a group named mysql on the system.

MySQL is not automatically started at the end of the installation process. Use the following command to start MySQL:

$> service mysql start

At the initial start up of the server, the server is initialized if the data directory of the server is empty. mysql_install_db is invoked with the --random-passwords option, which assigns a random password to the MySQL root accounts and sets the password expired flag for those accounts. It is necessary after installation to start the server, connect as root using the initial random password, and assign a new root password. Until this is done, root cannot do anything else. This must be done for each root account you intend to use. To change the password, you can use the SET PASSWORD statement (for example, with the mysql client). You can also use mysqladmin or mysql_secure_installation. For additional details (including where to find the assigned random root password), see Section 4.4.3, “mysql_install_db — Initialize MySQL Data Directory”. (Install operations using RPMs for Unbreakable Linux Network are unaffected because they do not run mysql_install_db.)

During an upgrade installation using RPM packages, if the MySQL server is running when the upgrade occurs then the MySQL server is stopped, the upgrade occurs, and the MySQL server is restarted. One exception: if the edition also changes during an upgrade (such as community to commercial, or vice-versa), then MySQL server is not restarted.

If something goes wrong during installation, you might find debug information in the error log file /var/lib/mysql/host_name.err.

Compatibility with RPM Packages from Other Vendors.  If you have installed packages for MySQL from your Linux distribution's local software repository, it is much preferable to install the new, directly-downloaded packages from Oracle using the package management system of your platform (yum or zypper), as described above. The command replaces old packages with new ones to ensure compatibility of old applications with the new installation; for example, the old MySQL-shared package is replaced with the MySQL-shared-compat package, which provides a replacement-compatible client library for applications that were using your older MySQL installation. If there was an older version of MySQL-shared-compat on the system, it also gets replaced.

If you have installed third-party packages for MySQL that are NOT from your Linux distribution's local software repository (for example, packages directly downloaded from a vendor other than Oracle), you should uninstall all those packages before installing the new, directly-downloaded packages from Oracle. This is because conflicts may arise between those vendor's RPM packages and Oracle's: for example, a vendor's convention about which files belong with the server and which belong with the client library may differ from that used for Oracle packages. Attempts to install an Oracle RPM may then result in messages saying that files in the RPM to be installed conflict with files from an installed package.

Debug Package.  A special variant of MySQL Server compiled with the debug package has been included in the server RPM packages. It performs debugging and memory allocation checks and produces a trace file when the server is running. To use that debug version, start MySQL with /usr/sbin/mysqld-debug, instead of starting it as a service or with /usr/sbin/mysqld. See Section 5.8.3, “The DBUG Package” for the debug options you can use.


The default plugin directory for debug builds changed from /usr/lib64/mysql/plugin to /usr/lib64/mysql/plugin/debug in 5.6.39. Previously, it was necessary to change plugin_dir to /usr/lib64/mysql/plugin/debug for debug builds.

Rebuilding RPMs from source SRPMs.  Source code SRPM packages for MySQL are available for download. They can be used as-is to rebuild the MySQL RPMs with the standard rpmbuild tool chain.


RPMs for NDB Cluster.  Standard MySQL server RPMs built by MySQL do not provide support for the NDBCLUSTER storage engine. For more information about installing NDB Cluster from RPMs, see Section 18.3, “NDB Cluster Installation”.