Mariadb enable binary log

Mariadb enable binary log

Hello colleagues.

In today's article, I will tell you how to enable binary log in MariaDB. The binary log contains a record of all changes to the databases, both data and structure, as well as how long it took to execute each statement. It consists of a set of binary log and index files. This means that statements such as CREATE , ALTER , INSERT , UPDATE , and DELETE will be logged, but statements that do not affect data, such as SELECT and SHOW, will not be logged.

 

Article content:

  1. Check if binary logging is enabled.
  2. Create a directory for binary logs.
  3. Let's edit the configuration file.
  4. Examination.
  5. Extra options.

 

 

1. Check if binary logging is enabled.

Before we change anything in the settings, let's check the system variables that respond to logging. The main variable responsible for enabling the binary log is called log_bin.

mariadb> show variables like 'log_bin';

mariadb_binary_log

We see in the screenshot the value of the Value field is OFF, which means that binary logging is disabled.


 

 

2. Create a directory for binary logs.

In this step, we will create a directory for the binary logs. If you do not do this and simply enable binary logging, then the logs themselves will be created in the directory where the database itself is stored.

$. mkdir /binary_log

$. chown -R mysql:mysql /binary_log


 

3. Let's edit the configuration file.

Now it's the turn to configure the configuration file itself. The file is located by default at /etc/my.cnf.d/server.cnf

$. vim /etc/my.cnf.d/server.cnf

mariadb_binary_log

Save and restart the server.


 

4. Examination.

mariadb_binary_log

mariadb_binary_log


 

5. Extra options.

There are a lot of additional binary log parameters, but I will not describe them in this article.

mariadb> show variables like '%bin%';

mariadb_binary_log


 

Thank you all, I hope my article was of some help to you.

SIMILAR ARTICLES

MariaDB - ERROR Incorrect definition of table
MariaDB - ERROR Incorrect definition of table
MARIADB
Read more
Mariabackup backup - gzip compression
Mariabackup backup - gzip compression
MARIADB
Read more
Mariabackup error - Error writing file UNKNOWN errno 32 Broken pipe
Mariabackup error - Error writing file UNKNOWN errno 32 Broken pipe
MARIADB
Read more