Book Image

Getting Started with MariaDB

By : Daniel Bartholomew
3 (1)
Book Image

Getting Started with MariaDB

3 (1)
By: Daniel Bartholomew

Overview of this book

MariaDB is a database that has become very popular in the few short years that it has been around. It does not require a big server or expensive support contract. It is also powerful enough to be the database of choice for some of the biggest and most popular websites in the world, taking full advantage of the latest computing hardware available. From installing and configuring through basic usage and maintenance, each chapter in this revised and expanded guide leads on sequentially and logically from the one before it, introducing topics in their natural order so you learn what you need, when you need it. The book is based on the latest release of MariaDB and covers all the latest features and functions. By the end of this beginner-friendly book, not only will you have a running installation of MariaDB, but you will have practical, hands-on experience in the basics of how to install, configure, administer, use, and maintain it.
Table of Contents (16 chapters)
Getting Started with MariaDB Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
MariaDB Next Steps
Index

Installing MariaDB on Debian, Ubuntu, and Linux Mint


The procedure to install MariaDB on Debian GNU/Linux, Ubuntu, and Linux Mint is easy and starts with a visit to the repository configuration tool from:

https://downloads.mariadb.org/mariadb/repositories

This tool is used for APT-based Linux distributions, such as Debian, Ubuntu, and Mint; Yum-based Linux distributions, such as Fedora, CentOS, and Red Hat; and other distributions that have support for MariaDB built-in, such as Mageia, Arch Linux, Suse, openSUSE, and others.

Tip

Many Linux distributions offer MariaDB in their repositories either as the default MySQL-compatible database or as an alternative choice. The instructions here will install MariaDB directly from the MariaDB repositories instead of from your Linux distribution's repositories.

Before using the tool, we need to know which version of Ubuntu, Debian, or Mint we are currently using. If you do not know, an easy way to find out is with the following command:

cat /etc/lsb-release

The output will be similar to the following:

DISTRIB_ID=Ubuntu

DISTRIB_RELEASE=14.04

DISTRIB_CODENAME=trusty

DISTRIB_DESCRIPTION="Ubuntu 14.04.1 LTS"

This example output shows that the computer is running Ubuntu 14.04.1 LTS "Trusty". So, using the repository configuration tool, we will click on Ubuntu, then 14.04 LTS "trusty", and then on the MariaDB series we want to install. Lastly, we will click on the mirror we want to use. The tool will then output three pieces of text. The first contains the commands to add the MariaDB repository to our system. The second contains the commands to actually install MariaDB. The third block of text contains alternative instructions in case adding the repository using the first set did not work.

For example, the generated commands for adding a repository for MariaDB 10.1 for Ubuntu 14.04 LTS "trusty" and using the osuosl mirror are as follows:

sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys \
--keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
sudo add-apt-repository \
'deb http://ftp.osuosl.org/pub/mariadb/repo/10.0/ubuntu trusty main'

The first command installs the software-properties-common package if it is not already installed. This package contains the add-apt-repository command we use to install the repository. The second command imports the GPG encryption key that is used to sign MariaDB packages. For more information about this key, see the MariaDB package security section later in this chapter. The third command adds the repository.

Now that the repository is configured, we can install MariaDB using the following installation commands:

sudo apt-get update
sudo apt-get install mariadb-server

The mariadb-server package depends on the other MariaDB packages, so these two commands are all we need to install MariaDB. Once the second apt-get command finishes, MariaDB will be installed and running.

To learn about installing MariaDB on Fedora, Red Hat, and CentOS, read on. Otherwise, jump ahead to the MariaDB package security section if you're interested in the MariaDB GPG signing keys, or skip to the After the installation section if you want to start using MariaDB right away.