Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL client history not logging some queries

Tags:

mysql

I have noticed that quite recently the mysql client tool is not logging all queries I issue. The behaviour seems to be very inconsistent; some queries are logged and others are not, without any definite pattern, although it seems the simpler the query, the more likely it is to be logged. This is annoying to say the least. I am using MySQL 5.6.14 under Ubuntu 12.04 LTS.

There really doesn't seem to be much of a pattern: a query like SELECT COUNT(*) FROM TABLE_X WHERE COL_1=3; might well be logged whereas SELECT COL_1,COUNT(COL_1) FROM TABLE_X GROUP BY COL_1 won't be.

Any ideas? This is a very recent release of MySQL and I'm only using it in development but I want to roll it out to our live machines since the microsecond timestamp resolution solves a number of issues I have in a much cleaner fashion than hitherto.

UPDATE: as per Alex_at_wearenotmachines below, any pattern of the form *PASSWORD* in the query disables logging, which is clearly an overly-broad criterion.

like image 704
David G Avatar asked Oct 23 '25 18:10

David G


2 Answers

Just reported this at bugs.mysql.com - are you getting the weird mysql> prompt suddenly appears in the middle of the command thing as well? And the average of about .75 seconds to run create table commands? seems a little slow....

Can't see any pattern either - it refused to remember SELECT password FROM users, ever. but remembered most other things. Have been using for about 3 weeks and just noticed today but going back through my history I can see kind of logical gaps where stuff is evidently missing.

like image 189
Alex_at_wearenotmachines Avatar answered Oct 26 '25 07:10

Alex_at_wearenotmachines


This really is a bug. There is no reason to remove it from the current in client history. It should be available to the person who just typed it!

Also, the patterns are overly broad. If there is no string literal, there is no sensitive data, so the patterns, rather than "IDENTIFIED:PASSWORD" should require a string literal somewhere in the line (still too broad but more reasonable) like: IDENTIFIED['"]*:*PASSWORD*['"]*

Additionally you should be able to override these patterns (like I've been writing multi table joins on password columns (don't ask) and I can't even up arrow to put in a missing comma...)

One more things (Thank you Brian Matthews! http://forums.mysql.com/read.php?11,631456,631456#msg-631456) if you are completely ham strung by this like I am, you can disable it by hexediting the mysql client binary. Ugly, but effective. I now have a script called fix_mysql_client...

like image 24
Wayne Walker Avatar answered Oct 26 '25 08:10

Wayne Walker



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!