How do I register only raw queries in MySQL?

I have my log file, but I get extraneous information on each line, for example, “29 Query”, and I can’t say, but it looks like the logged queries are an interpretation of how MySQL processes each query internally. Is there a way to automatically log each request as it is executed by the application without additional information added to the MySQL log? Thanks!

EDIT:

As part of offering generosity, let me explain my situation. We use Magento Commerce, which has an EAV database architecture. Keeping track of something down and where it is stored is an absolute nightmare. My thought was to insert the product into the database in the application, and then register every request that was executed during this process. This worked well, but there are a ton of other circles around the queries in the logs. I really need something like this:

1.) SELECT * FROM <TABLE>;
2.) UPDATE <TABLE> SET <VALUE> = <VALUE>;
3.) ...
4.) ...

Something simple that tells me what has been done, so I don’t have to go through the screening through the controllers and models to try to get it all. I do not need dates, times, line numbers or anything else.

+3
source share
4

, my.cnf:

log=/var/log/mysqldquery.log

.

mysql my.cnf.

SequelPro (mac client):

090721 11:06:45      51 Query       ALTER TABLE `test` ADD `name` varchar(10) DEFAULT NULL
                     51 Query       SHOW COLUMNS FROM `test`
                     51 Query       SHOW INDEX FROM `test`
090721 11:06:57      51 Query       SHOW COLUMNS FROM `test`
                     51 Query       UPDATE `test` SET `id`='1', `name`='test' WHERE `id` = '1' AND `name` IS NULL LIMIT 1
                     51 Query       SELECT * FROM `test` LIMIT 0,100
                     51 Query       SELECT COUNT(1) FROM `test`   
090721 11:07:00      51 Query       UPDATE `test` SET `id`='2', `name`='test' WHERE `id` = '2' AND `name` IS NULL LIMIT 1
                     51 Query       SELECT * FROM `test` LIMIT 0,100
                     51 Query       SELECT COUNT(1) FROM `test`

, * NIX, grep

grep 'SELECT\|INSERT\|UPDATE' querylog.log

, :

grep 'SELECT\|INSERT\|UPDATE' querylog.log | awk '{$1="";$2="";print}'

- , , :

  51 Query UPDATE `test` SET `id`='2', `name`='test' WHERE `id` = '2' AND `name` IS NULL LIMIT 1
  SELECT * FROM `test` LIMIT 0,100
  SELECT COUNT(1) FROM `test`
  51 Query INSERT INTO `test` (`id`,`name`) VALUES ('3','testing')
  SELECT * FROM `test` LIMIT 0,100
  SELECT COUNT(1) FROM `test`
+9

mysql. mysql:

--log=/var/log/mysqld.log
+4

, mysqlbinlog, , .

cat log100.log | mysqlbinlog 
+1

?

http://www.bigdbahead.com/?p=99

There are 2 solutions there - one is simpler, but requires mysql 5.1 +.

+1
source

Source: https://habr.com/ru/post/1711777/


All Articles