Show log of MySQL when running query in rails

When you run query to select, update, insert… in ruby, you can show log realtime when query is running.

First, go to MySQL and run:

show variables like '%log%';

And find record with variable_name =  general_log_file and get its value. In case, value is /var/lib/mysql/OFF016.log

mysql

Then, set

set global general_log = 1;

Then, open terminal and run:

sudo tailf <value>

In case is:

sudo tailf /var/lib/mysql/OFF016.log

Advertisements