Book Image

Getting Started with MariaDB

By : Daniel Bartholomew
Book Image

Getting Started with MariaDB

By: Daniel Bartholomew

Overview of this book

<p>In the modern age, storing data is of paramount importance, and this is where databases enter the picture. MariaDB is a relatively new database that has become very popular in a short amount of time. It is a community-developed fork of MySQL and it is designed to be an enhanced and backward compatible database solution.</p> <p>Getting Started with MariaDB is a practical, hands-on, beginner-friendly guide to installing and using MariaDB. This book will start with the installation of MariaDB before moving on to the basics. You will then learn how to configure and maintain your database with the help of real-world examples.</p> <p>Getting Started with MariaDB literally starts at square one by walking you through the basics of what you need to know about MariaDB. This book will teach you how to install MariaDB as well as how to configure it. Following that, you will then be shown how to secure MariaDB. This book will also teach you common commands and will help you learn how to maintain a MariaDB server.</p>
Table of Contents (14 chapters)

Checking and repairing tables


After a hardware failure, after a power outage, or even after an upgrade, it is a good idea to check the tables in our MariaDB databases to make sure they are ok. MariaDB includes several utilities to do this.

Checking and optimizing tables with mysqlcheck

The mysqlcheck program can check, analyze, optimize, and repair MariaDB database tables. Basic syntax for the command is as follows:

mysqlcheck [options] [-u username] [-p] database_name [table_name]

Here is an example of running the command to check our test database, and its output:

daniel@gandalf:~$ mysqlcheck -u root -p test
Enter password:
test.employees                                     OK

We can specify multiple databases using the --databases option as follows:

mysqlcheck -u root -p --databases db_name1 db_name2 db_name3

We can also tell the program to check all of our databases with the --all-databases option, as follows:

mysqlcheck -u root -p --all-databases

By default, mysqlcheck will only check tables...