MySQL – MariaDB Query Log

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

AHMED ELKHAYYAT
https://elkhayyat.me

I am a very keen individual that enjoys developing Python Programming Language. I have always loved computers and technology, ever since childhood. A team player who loves to work with other people on innovative projects and to take on challenges as an opportunity to grow as an individual in both a professional and personal capacity.

Leave a Reply

Select your currency
USD United States (US) dollar