2.4. Installing MySQL on Linux

MySQL 5.0

2.4. Installing MySQL on Linux

The recommended way to install MySQL on Linux is by using the RPM packages. The MySQL RPMs are currently built on a SuSE Linux 7.3 system, but should work on most versions of Linux that support rpm and use . To obtain RPM packages, see Section 2.1.3, “How to Get MySQL”.

MySQL AB does provide some platform-specific RPMs; the difference between a platform-specific RPM and a generic RPM is that a platform-specific RPM is built on the targeted platform and is linked dynamically whereas a generic RPM is linked statically with LinuxThreads.

Note: RPM distributions of MySQL often are provided by other vendors. Be aware that they may differ in features and capabilities from those built by MySQL AB, and that the instructions in this manual do not necessarily apply to installing them. The vendor's instructions should be consulted instead.

If you have problems with an RPM file (for example, if you receive the error ' could not be looked up), see Section 2.13.1.2, “Linux Binary Distribution Notes”.

In most cases, you need to install only the and packages to get a functional MySQL installation. The other packages are not required for a standard installation. If you want to run a MySQL-Max server that has additional capabilities, you should also install the RPM. However, you should do so only after installing the RPM. See Section 5.3, “The mysqld-max Extended MySQL Server”.

If you get a dependency failure when trying to install MySQL packages (for example, ), you should also install the package, which includes both the shared libraries for backward compatibility ( for MySQL 4.0 and for MySQL 3.23).

Some Linux distributions still ship with MySQL 3.23 and they usually link applications dynamically to save disk space. If these shared libraries are in a separate package (for example, ), it is sufficient to simply leave this package installed and just upgrade the MySQL server and client packages (which are statically linked and do not depend on the shared libraries). For distributions that include the shared libraries in the same package as the MySQL server (for example, Red Hat Linux), you could either install our 3.23 RPM, or use the package instead. (Do not install both.)

The following RPM packages are available:

  • .i386.rpm

    The MySQL server. You need this unless you only want to connect to a MySQL server running on another machine.

    Note: Server RPM files were called .i386.rpm before MySQL 4.0.10. That is, they did not have in the name.

  • .i386.rpm

    The MySQL-Max server. This server has additional capabilities that the one provided in the RPM does not. You must install the RPM first, because the RPM depends on it.

  • .i386.rpm

    The standard MySQL client programs. You probably always want to install this package.

  • .i386.rpm

    Tests and benchmarks. Requires Perl and the and modules.

  • .i386.rpm

    The libraries and include files that are needed if you want to compile other MySQL clients, such as the Perl modules.

  • .i386.rpm

    This package contains the shared libraries () that certain languages and applications need to dynamically load and use MySQL. It contains single-threaded and thread-safe libraries. If you install this package, do not install the package.

  • .i386.rpm

    This package includes the shared libraries for MySQL 3.23, 4.0, 4.1, and 5.0. It contains single-threaded and thread-safe libraries. Install this package instead of if you have applications installed that are dynamically linked against older versions of MySQL but you want to upgrade to the current version without breaking the library dependencies.

  • .i386.rpm

    The embedded MySQL server library (available as of MySQL 4.0).

  • .src.rpm

    This contains the source code for all of the previous packages. It can also be used to rebuild the RPMs on other architectures (for example, Alpha or SPARC).

To see all files in an RPM package (for example, a RPM), run a commnd like this:

shell> .i386.rpm

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

shell> .i386.rpm
shell> .i386.rpm

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

shell> .i386.rpm

RPM provides a feature to verify the integrity and authenticity of packages before installing them. If you would like to learn more about this feature, see Section 2.1.4, “Verifying Package Integrity Using MD5 Checksums or .

The server RPM places data under the directory. The RPM also creates a login account for a user named (if one does not exist) to use for running the MySQL server, and creates the appropriate entries in 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 don't lose it when you install a newer RPM.) See Section 2.10.2.2, “Starting and Stopping MySQL Automatically”, for more information on how MySQL can be started automatically on system startup.

If you want to install the MySQL RPM on older Linux distributions that do not support initialization scripts in (directly or via a symlink), you should create a symbolic link that points to the location where your initialization scripts actually are installed. For example, if that location is , use these commands before installing the RPM to create as a symbolic link that points there:

shell> 
shell> 

However, all current major Linux distributions should support the new directory layout that uses , because it is required for LSB (Linux Standard Base) compliance.

If the RPM files that you install include , the mysqld server should be up and running after installation. You should be able to start using MySQL.

If something goes wrong, you can find more information in the binary installation section. See Section 2.8, “Installing MySQL on Other Unix-Like Systems”.

Note: 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, “Post-Installation Setup and Testing”.