How to Add MariaDB Error Log File on CentOS 8

  • Last update: Apr 3, 2024
  • Views: 39
  • Author: Admin
How to Add MariaDB Error Log File on CentOS 8

Hello colleagues.

In today's article, I will show you how to enable log_error error logging in MariaDB. After installing MariaDB, by default the error logging is not enabled and we will not be able to look at errors that may occur in the DBMS. The error log itself contains a record of critical errors that occurred during server operation, table corruption, information about starting and stopping, and much more.

This article is suitable for the database administrator, programmers and engineers.

 

The content of the article:

  1. Checking the status of the log_error variable.
  2. Create a directory for the error log.
  3. Let's edit the configuration file.

 

1. Checking the status of the log_error variable.

So, colleagues, as I said above, by default, the error log is not included in MariaDB. To check the status of the log_error variable, use the command in the console:

MariaDB [(none)]> SHOW VARIABLES LIKE 'log_error';

As you can see in the picture, the Value field is empty, which means that error logging is disabled.


 

2. Create a directory for the error log.

Before changing anything in the DBMS, let's first create a directory in which we will store the log.

$. sudo mkdir -p /app/mariadb/log_error

$. sudo chown -R mysql:mysql /app/mariadb/log_error


 

3. Let's edit the configuration file.

After we have created the necessary directory for storing the error log, let's specify the log_error variable in the configuration file. The server.cnf configuration file is located in the /etc/my.cnf.d directory

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

Add the variable log_error and specify the path to the directory.

Save and close.

 

We restart the database.

$. sudo service mariadb restart

 

After restarting the server, a file will appear in the directory that we created.

 

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

SIMILAR ARTICLES