Database Reference
In-Depth Information
MariaDB Maintenance
Just like houses and cars, databases need to be maintained if they are to run
smoothly. In this chapter we'll cover a variety of maintenance-related topics. We'll
start with an exploration of the various MariaDB log files, which tell us what
MariaDB is doing. Then we'll move on to a discussion about optimizing MariaDB.
We'll then discuss what is probably the most important part of maintaining our
database: backups. Lastly, we'll cover the utilities MariaDB includes to repair tables.
MariaDB log files
Depending on how we configure it, MariaDB will keep very detailed or very sparse
logs. The location of these logs is configured in our my.cnf ( my.ini on Windows)
MariaDB configuration file. On Linux, the default location is /var/log/mysql/ and
on Windows the default location is in the MariaDB data directory.
There are several different kinds of logs, each kind serving a different purpose.
The all-important binary log
The MariaDB binary log is a series of files that contain events. An event is a description
of a modification to the contents of our database. As indicated by the name, and unlike
most other kinds of log files, MariaDB binary log files are in a binary format. They are
not readable by us unless we use a helper program such as mysqlbinlog .
The binary log is controlled by the log_bin variable. The main purpose of the
variable is to turn binary logging on and off. Basically, if the variable is present in the
[mysqld] section of our config file, binary logging will be turned on, and if it isn't,
binary logging will be turned off. An optional function of this variable is to set the
name and location of the binary log. Here is an example:
log_bin = /var/log/mysql/mariadb-bin
Search WWH ::




Custom Search