2.5.5 Installing MySQL on Linux Using RPM Packages


To install or upgrade to MySQL 5.6.11 or later, be sure to read the special instructions at the end of this section.

The recommended way to install MySQL on RPM-based Linux distributions that use glibc is by using the RPM packages provided by MySQL. There are two sources for obtaining the Community versions of the RPM packages:

The discussions in this section only apply to the RPM packages directly downloaded from the MySQL Developer Zone. Installations created with these packages result in files under the system directories shown in the following table.

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

DirectoryContents of Directory
/usr/binClient programs and scripts
/usr/sbinThe mysqld server
/var/lib/mysqlLog files, databases
/usr/share/infoMySQL manual in Info format
/usr/share/manUnix manual pages
/usr/include/mysqlInclude (header) files
/usr/share/mysqlMiscellaneous support files, including error messages, character set files, sample configuration files, SQL for database installation


RPM distributions of MySQL are also provided by other vendors. Be aware that they may differ from those built by us in features, capabilities, and conventions (including communication setup), and that the instructions in this manual do not necessarily apply to installing them. The vendor's instructions should be consulted instead. Because of these differences, RPM packages built by us check whether such RPMs built by other vendors are installed. If so, the RPM does not install and produces a message explaining this.

Conflicts can arise when an RPM from another vendor is already installed, such as when a vendor's convention about which files belong with the server and which belong with the client library differ from the breakdown used for Oracle packages. In such cases, attempts to install an Oracle RPM with rpm -i may result in messages that files in the RPM to be installed conflict with files from an installed package (denoted mysql-libs in the following paragraphs).

We provide a MySQL-shared-compat package with each MySQL release. This package is meant to replace mysql-libs and provides a replacement-compatible client library for older MySQL series. MySQL-shared-compat is set up to make mysql-libs obsolete, but rpm explicitly refuses to replace obsoleted packages when invoked with -i (unlike -U), which is why installation with rpm -i produces a conflict.

MySQL-shared-compat can safely be installed alongside mysql-libs because libraries are installed to different locations. Therefore, it is possible to install shared-compat first, then manually remove mysql-libs before continuing with the installation. After mysql-libs is removed, the dynamic linker stops looking for the client library in the location where mysql-libs puts it, and the library provided by the MySQL-shared-compat package takes over.

Another alternative is to install packages using yum. In a directory containing all RPM packages for a MySQL release, yum install MySQL*rpm installs them in the correct order and removes mysql-libs in one step without conflicts.

In most cases, you need to install only the MySQL-server and MySQL-client packages to get a functional MySQL installation. The other packages are not required for a standard installation.

As of MySQL 5.6.8, new RPM install operations (not upgrades) invoke mysql_install_db with the --random-passwords option that provides for more secure MySQL installation. Invoking mysql_install_db with --random-passwords causes it to assign a random password to the MySQL root accounts, set the password expired flag for those accounts, and not create anonymous-user MySQL accounts. It will be necessary after installation to start the server, connect as root using the password written to the $HOME/.mysql_secret file, 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, 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 use mysql_install_db.)


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

When upgrading a MySQL Cluster RPM installation, you must upgrade all installed RPMs, including the Server and Client RPMs.

For upgrades, if your installation was originally produced by installing multiple RPM packages, it is best to upgrade all the packages, not just some. For example, if you previously installed the server and client RPMs, do not upgrade just the server RPM.

If the data directory exists at RPM installation time, the installation process does not modify existing data. This has the effect, for example, that accounts in the grant tables are not initialized to the default set of accounts.

If you get a dependency failure when trying to install MySQL packages (for example, error: removing these packages would break dependencies: libmysqlclient.so.10 is needed by ...), you should also install the MySQL-shared-compat package, which includes the shared libraries for older releases for backward compatibility.

The RPM packages shown in the following list are available. The names shown here use a suffix of .linux_glibc2.5.i386.rpm, but particular packages can have different suffixes, described later. If you plan to install multiple RPM packages, you may wish to download the RPM Bundle tar file instead, which contains multiple RPM packages to that you need not download them separately.

The suffix of RPM package names (following the VERSION value) has the following syntax:


The PLATFORM and CPU values indicate the type of system for which the package is built. PLATFORM indicates the platform and CPU indicates the processor type or family.

All packages are dynamically linked against glibc 2.5. The PLATFORM value indicates whether the package is platform independent or intended for a specific platform, as shown in the following table.

Table 2.7 MySQL Linux Installation Packages

PLATFORM ValueIntended Use
linux_glibc25Platform independent, should run on any Linux distribution that supports glibc 2.5
rhel5, rhel6Red Hat Enterprise Linux 5 or 6
el6, el7Enterprise Linux 6 or 7
sles10, sles11SUSE Linux Enterprise Server 10 or 11

In MySQL 5.6, only linux_glibc2.5 packages are available currently.

The CPU value indicates the processor type or family for which the package is built.

Table 2.8 MySQL Installation Packages for Linux CPU Identifiers

CPU ValueIntended Processor Type or Family
i386, i586, i686Pentium processor or better, 32 bit
x86_6464-bit x86 processor
ia64Itanium (IA-64) processor

To see all files in an RPM package (for example, a MySQL-server RPM), run a command like this:

shell> rpm -qpl MySQL-server-VERSION.linux_glibc2.5.i386.rpm

To perform a standard minimal installation, install the server and client RPMs:

shell> rpm -i MySQL-server-VERSION.linux_glibc2.5.i386.rpm
shell> rpm -i MySQL-client-VERSION.linux_glibc2.5.i386.rpm

To install only the client programs, install just the client RPM:

shell> rpm -i MySQL-client-VERSION.linux_glibc2.5.i386.rpm

RPM provides a feature to verify the integrity and authenticity of packages before installing them. To learn more about this feature, see Section 2.1.3, “Verifying Package Integrity Using MD5 Checksums or GnuPG”.

The server RPM places data under the /var/lib/mysql directory. The RPM also creates a login account for a user named mysql (if one does not exist) to use for running the MySQL server, and creates the appropriate entries in /etc/init.d/ to start the server automatically at boot time. (This means that if you have performed a previous installation and have made changes to its startup script, you may want to make a copy of the script so that you do not lose it when you install a newer RPM.) See Section 2.10.5, “Starting and Stopping MySQL Automatically”, for more information on how MySQL can be started automatically on system startup.

In MySQL 5.6, during a new installation, the server boot scripts are installed, but the MySQL server is not started at the end of the installation, since the status of the server during an unattended installation is not known.

In MySQL 5.6, during an upgrade installation using the RPM packages, if the MySQL server is running when the upgrade occurs, the MySQL server is stopped, the upgrade occurs, and the MySQL server is restarted. If the MySQL server is not already running when the RPM upgrade occurs, the MySQL server is not started at the end of the installation.


If you are upgrading from a community version to a commercial version of MySQL (which actually requires you to first uninstall the community version and then install the commercial version), you must restart the server manually after the upgrade.

If something goes wrong, you can find more information in the binary installation section. See Section 2.2, “Installing MySQL on Unix/Linux Using Generic Binaries”.


The accounts that are listed in the MySQL grant tables initially have no passwords. After starting the server, you should set up passwords for them using the instructions in Section 2.10, “Postinstallation Setup and Testing”.

During RPM installation, a user named mysql and a group named mysql are created on the system. This is done using the useradd, groupadd, and usermod commands. Those commands require appropriate administrative privileges, which is required for locally managed users and groups (as listed in the /etc/passwd and /etc/group files) by the RPM installation process being run by root.

If you log in as the mysql user, you may find that MySQL displays Invalid (old?) table or database name errors that mention .mysqlgui, lost+found, .mysqlgui, .bash_history, .fonts.cache-1, .lesshst, .mysql_history, .profile, .viminfo, and similar files created by MySQL or operating system utilities. You can safely ignore these error messages or remove the files or directories that cause them if you do not need them.

For nonlocal user management (LDAP, NIS, and so forth), the administrative tools may require additional authentication (such as a password), and will fail if the installing user does not provide this authentication. Even if they fail, the RPM installation will not abort but succeed, and this is intentional. If they failed, some of the intended transfer of ownership may be missing, and it is recommended that the system administrator then manually ensures some appropriate user and group exists and manually transfers ownership following the actions in the RPM spec file.

In MySQL 5.6.11, the RPM spec file has been updated, which has the following consequences:

Additional details follow.

For a non-upgrade installation of MySQL 5.6.11 or later, it is possible to install using yum:

shell> yum install MySQL-server-NEWVERSION.linux_glibc2.5.i386.rpm

For upgrades to MySQL 5.6.11 or later, the upgrade is performed by removing the old installation and installing the new one. To do this, use the following procedure:

  1. Remove the existing 5.6.X installation. OLDVERSION is the version to remove.

    shell> rpm -e MySQL-server-OLDVERSION.linux_glibc2.5.i386.rpm

    Repeat this step for all installed MySQL RPMs.

  2. Install the new version. NEWVERSION is the version to install.

    shell> rpm -ivh MySQL-server-NEWVERSION.linux_glibc2.5.i386.rpm

Alternatively, the removal and installation can be done using yum:

shell> yum remove MySQL-server-OLDVERSION.linux_glibc2.5.i386.rpm
shell> yum install MySQL-server-NEWVERSION.linux_glibc2.5.i386.rpm