MySQL – MariaDB Query Log

Introduction

Sometimes you need to see how an action affects your database. What are queries used on the database level to optimize your project flow, or for debugging reasons.

How?

MySQL and MariaDB offer query logging options.

Go to your database configuration file:

In my case [using MariaDB – CentOS] it is located at

/etc/my.cnf.d/server.cnf

adding those couple of lines:

[mariadb]
general_log_file       = /var/log/mariadb/general-query.log
general_log            = 1

Restart your MariaDB/MySQL server

Now you can see raw SQL queries logged in that file

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Select your currency
USD United States (US) dollar