Book Image

Getting Started with MariaDB

By : Daniel Bartholomew
Book Image

Getting Started with MariaDB

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 Fedora, Red Hat, and CentOS


The procedure to install MariaDB on Fedora, Red Hat, and CentOS makes use of the Yellowdog Updater, Modified (YUM) package manager. There are two steps: first, create a repo file for MariaDB and second, install MariaDB.

To generate the required text for the repo file, we will visit the MariaDB repository configuration tool from:

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

Tip

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.

To generate the text, we simply click on the distribution we are using, the distribution release we are using, and the version of MariaDB we want to install. After doing so, the contents of the appropriate repo file will be displayed.

For example, the text generated for MariaDB 10.1 on the 64-bit version of CentOS 7 is as follows:

# MariaDB 10.1 CentOS repository list
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

The gpgkey line tells YUM where the GPG signing key is located. The gpgcheck=1 line directs YUM to always use the signing key to verify the MariaDB packages.

The first time we install MariaDB, our system will not have the key, so YUM will have to download and install it. Since YUM has never used the key before, it will ask for confirmation whether it is OK to import the key. See the MariaDB package security section for more information on the MariaDB GPG signing key.

We copy and paste the generated text into a file using our favorite text editor. Naming the file descriptively, such as MariaDB.repo, is recommended. Once the file is created, we then move it to the /etc/yum.repos.d/ folder using a command similar to the following one:

sudo mv -vi MariaDB.repo /etc/yum.repos.d/

Once the file is in place, we are ready to install MariaDB. This is as simple as the following:

sudo yum install MariaDB-server MariaDB-client

The capitalization of the package names is important because if we type mariadb-server instead of MariaDB-server, we will either get a package cannot be found error or, if we are using a distribution that includes MariaDB, we will get the distribution version of MariaDB instead of the version from the MariaDB project.

YUM will gather in all of the dependencies for MariaDB and present us with a list of everything that needs to be installed to install MariaDB. The following screenshot shows this:

After answering y, the installation will get going and we will be prompted to accept the GPG signing key. We will verify the fingerprint with y. YUM will then continue downloading and installing MariaDB and will end with a Complete! message.

As a final step of the installation, we start MariaDB with the following command:

sudo /etc/init.d/mysql start

If everything has gone well, we will see output similar to the following:

[dbart@centos70-x86-64 ~]$ sudo /etc/init.d/mysql start

Starting MySQL.. SUCCESS! 

MariaDB is now installed and running.

Jump ahead to the MariaDB package security section if you're interested in the MariaDB GPG signing key, or skip to the After the installation section if you want to start using MariaDB right away.