Linux/UNIX Installation
Follow these steps to install MariaDB on a Linux/UNIX server. You must be logged in as the root user to install MariaDB.
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 (MariaDB-server)The MariaDB database server. You must install this package.
-
Client programs (MariaDB-client)Contains the client programs for communicating with a MariaDB server, including MariaDB and mysqladmin.
-
Libraries and header files (MariaDB-devel)Development libraries and header files required for creating statically linked programs with the C API.
-
Dynamic client libraries (MariaDB-shared)Shared libraries required for creating and running dynamically linked client programs.
-
Benchmark/test suites (MariaDB-bench)A series of programs used to test the performance of a MariaDB server.
The full filename of a package consists of the prefix shown in this list, the MariaDB version number, and the platform it is compiled for.
For example, the latest version of the MariaDB Server package for an Intel-based Linux system is installed from an RPM package named MariaDB-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 MariaDB*.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 MariaDB. You can start the MariaDB server by issuing the following command:
# /sbin/service MariaDB start
Binary Installation
If you are unable to use RPM, you will still likely find a precompiled binary version of MariaDB 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 MariaDB using the correct binary distribution than from a MariaDB server you compiled from source.
The binary distribution of MariaDB 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 MariaDB 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 MariaDB 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 MariaDB 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
MariaDB is open source, so you are free to download the complete source code, if you want. This section deals with installing MariaDB 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 MariaDB 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 MariaDB 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 MariaDB server and client programs and the development libraries.
# make
Compiling MariaDB 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.