Fórum

See raw MySQL queries from Liferay and elsewhere

thumbnail
James Falkner, modificado 8 Anos atrás.

See raw MySQL queries from Liferay and elsewhere

Liferay Legend Postagens: 1399 Data de Entrada: 17/09/10 Postagens Recentes
Are you using a local MySQL instance with Liferay, and want to see the actual sql being issued to the database (without all those pesky placeholders, instead with the actual values)?

I found this nice script that works on most unix OS's (including OS X) and shall re-post it here with kudos to Maciej. It may need modification if you are doing non-stock configuration (ports, protocols, etc). Also it must be normally run with superuser privs (e.g. sudo).


#!/bin/bash
#this script used monitor mysql network traffic.echo sql
tcpdump -i any -s 0 -l -w - dst port 3306 | strings | perl -e '
while(<>) { chomp; next if /^[^ ]+[ ]*$/;
    if(/^(SELECT|UPDATE|DELETE|INSERT|SET|COMMIT|ROLLBACK|CREATE|DROP|ALTER|CALL)/i)
    {
        if (defined $q) { print "$q\n"; }
        $q=$_;
    } else {
        $_ =~ s/^[ \t]+//; $q.=" $_";
    }
}'
thumbnail
David H Nebinger, modificado 8 Anos atrás.

RE: See raw MySQL queries from Liferay and elsewhere

Liferay Legend Postagens: 14914 Data de Entrada: 02/09/06 Postagens Recentes
Isn't that what we use p6spy for?
thumbnail
James Falkner, modificado 8 Anos atrás.

RE: See raw MySQL queries from Liferay and elsewhere

Liferay Legend Postagens: 1399 Data de Entrada: 17/09/10 Postagens Recentes

[jhf@JamesFaBPUpdate]  ~  $ p6spy
-bash: p6spy: command not found
thumbnail
David H Nebinger, modificado 8 Anos atrás.

RE: See raw MySQL queries from Liferay and elsewhere

Liferay Legend Postagens: 14914 Data de Entrada: 02/09/06 Postagens Recentes
?

It's not a command, it works as a JDBC driver to log everything and it's database-neutral.

https://p6spy.github.io/p6spy/
thumbnail
James Falkner, modificado 8 Anos atrás.

RE: See raw MySQL queries from Liferay and elsewhere

Liferay Legend Postagens: 1399 Data de Entrada: 17/09/10 Postagens Recentes
;) p6spy is nice no doubt, but it requires installation, restarting the server, modifying files, etc. The script you just run and it works with no special setup or no server restarts using out of the box unix tools. It only works in the default case of MySQL running locally on port 3306.