Installing MySQL on Linux/Unix

The process of installing MySQL on Linux/Unix is straightforward, whether you use RPMs or install the binaries. If you choose to install from RPMs, there are several that make up a full distribution. For a minimal installation you need

  • MySQL-VERSION.i386.rpm? The MySQL server

  • MySQL-client-VERSION.i386.rpm? The standard MySQL client programs

To perform the minimal installation, type the following at the prompt:

#> rpm -i MySQL-VERSION.i386.rpm MySQL-client-VERSION.i386.rpm


Replace VERSION in the filename with the actual version you downloaded. For example, the current MySQL-Pro 4.0 server RPM is called MySQL-4.0.4-0.i386.rpm.

Another painless installation method is to install MySQL from a binary distribution. This method requires gunzip and tar to uncompress and unpack the distribution and also requires the ability to create groups and users on the system. The first series of commands in the binary distribution installation process has you adding a group and a user and unpacking the distribution, as follows:

#> groupadd mysql
#> useradd -g mysql mysql
#> cd /usr/local
#> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -

Next, the instructions tell you to create a link with a shorter name:

#> ln -s mysql-VERSION-OS mysql
#> cd mysql

Once unpacked, the README and INSTALL files will walk you through the remainder of the installation process for the version of MySQL you've chosen. In general, the following series of commands will be used:

#> scripts/mysql_install_db
#> chown -R root /usr/local/mysql
#> chown -R mysql /usr/local/mysql/data
#> chgrp -R mysql /usr/local/mysql
#> chown -R root /usr/local/mysql/bin

You're now ready to start the MySQL server.

    Part III: Getting Involved with the Code