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