LinuxUNIX Installation


Linux/UNIX Installation

Follow these steps to install MySQL on a Linux/UNIX server. You must be logged in as the root user to install MySQL.

RPM Installation for Linux

If you are using a Linux system that supports RPM packages, such as Red Hat, SUSE, or Fedora, this is the easiest installation method to use. You simply download the appropriate packages and install them using the rpm utility.

The RPM distribution is split into the following packages. The filename prefix for each package is shown in parentheses.

  • Server (MySQL-server)The MySQL database server. You must install this package.

  • Client programs (MySQL-client)Contains the client programs for communicating with a MySQL server, including mysql and mysqladmin.

  • Libraries and header files (MySQL-devel)Development libraries and header files required for creating statically linked programs with the C API.

  • Dynamic client libraries (MySQL-shared)Shared libraries required for creating and running dynamically linked client programs.

  • Benchmark/test suites (MySQL-bench)A series of programs used to test the performance of a MySQL server.

The full filename of a package consists of the prefix shown in this list, the MySQL version number, and the platform it is compiled for.

For example, the latest version of the MySQL Server package for an Intel-based Linux system is installed from an RPM package named MySQL-server-5.0.18-0.i386.rpm.

Use the rpm command with the i switch to install the RPM packages. If you have downloaded several packages, you can install them together by using the following command:

$ rpm i MySQL*.rpm 


RPM Versions

Specific sets of RPM packages exist for Red Hat Enterprise Linux and SUSE Enterprise Linux. If you use one of these enterprise platforms, you must obtain the correct RPM versions.


RPM installation creates a service for MySQL. You can start the MySQL server by issuing the following command:

# /sbin/service mysql start 


Binary Installation

If you are unable to use RPM, you will still likely find a precompiled binary version of MySQL available for your system.

Binary Distribution

The precompiled binary distributions and RPM packages are highly optimized for a particular platform. You will usually achieve better performance from MySQL using the correct binary distribution than from a MySQL server you compiled from source.


The binary distribution of MySQL is a single compressed archive that contains the server, client programs, and development libraries. It is downloadable in a .tar.gz filearchived using tar and compressed using gzip. Three versions of each binary distribution exist: Standard, Max, and Debug.

  • The Standard binaries are fine for most usersthis is an optimized MySQL server with all the common features enabled at compile time.

  • The Max binaries include additional features that are new or are not yet considered fully stable. You should consider using the Max distribution only if you have a specific need for it.

  • The Debug binaries have additional debugging information compiled and are not suitable for general use. You should not use this distribution.

The binary download filename consists of mysql-standard (or mysql-max, for Max) followed by the version number and the platform. For example, if you are installing MySQL on an Intel-based OpenBSD system, the package you require will be named mysql-standard-5.0.16-openbsd3.7-i386.

After downloading the appropriate file, extract it using the following command. Use the cd command to navigate to the location where you want to install the files first: /usr/mysql and /usr/local/mysql are typical locations.

$ tar zxvf mysql-standard-5.0.16-openbsd3.7-i.386.tar.gz 


Paths

A binary installation does not automatically install its files to a location in your path. You will probably want to add /usr/mysql/bin or /usr/local/mysql/bin to your path for convenience.


To start the MySQL server, run the mysqld_safe program, which will have been installed to the bin directory. You should run this program in the background as follows:

# /usr/local/mysql/bin/mysqld_safe & 


Installing from Source

MySQL is open source, so you are free to download the complete source code, if you want. This section deals with installing MySQL from source code.

The source code downloads appear at the very bottom of the downloads page. They are available as a .tar.gz file; the filename simply contains the version number.

Begin by extracting the latest version of the MySQL source to a suitable location, such as /usr/local/src.

# tar zxvf mysql-5.0.18.tar.gz 


Next, run the configure program to allow the MySQL installation process to gather information about your system.

Compile-Time Configuration

You can provide additional compile-time options here using switches to the configure program. For a list of the available switches and their default values, run configure--help.


# ./configure


The configure program generates a Makefile, so now you can run the make command to compile the MySQL server and client programs and the development libraries.

# make 


Compiling MySQL might take some time, but when it is complete, you can install the various components to their correct locations by issuing a make install command.

Install Locations

The default locations for a source installation are under /usr/local (/usr/local/bin for programs, /usr/local/include and /usr/local/lib for development files). Use the --prefix compile-time switch to specify a different location.





Sams Teach Yourself MySQL in 10 Minutes
Sams Teach Yourself MySQL in 10 Minutes
ISBN: 0672328631
EAN: 2147483647
Year: 2006
Pages: 165
Authors: Chris Newman

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net