Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Tracking mySQL Connection and Query Statements

Posted on 2004-08-03
3
Medium Priority
?
898 Views
Last Modified: 2008-02-01
This might not have an answer but if there is any possible options, please chime in...

The server environment is mySQL 4.x under red hat 9
The client is vb.net application with Seven Objects mySQL OLEDB integration ( http://www.sevenobjects.com ) A second client application is legacy app which requires ODBC connectivity.

The vb.net client has audit and tracing built in. The legacy app hooks in using mySQL ODBS v3.51 on the local machine. We have a problem where there is believed to be an enterprising individual making ODBC connections via ODBC and not only viewing data but in some cases dropping tables or deleting ranges of records. The most obvious solution would be to rewrite the legacy app... Being done, but it will be months to finish. Customer needs a more immediate fix.

The question: mySQL does not have and can not currently be recompiled with the --DEBUG functionality which would allow us to turn on a trace to determine where this connection is coming from and record the query sent to the server. I need to do these in some other fashion. Does anyone have any insight on what I could do to track down this possible rogue user. This question is time critical...

Thank you very, very much in advance...
Gregory A. Miller
AGBSM Networks
AGBSM, LLC

If there are multiple suggestions from multiple persons which yield good advice and is useable in the scenario listed, I will be happy to split points and/or add more...
0
Comment
Question by:Gregory Miller
  • 2
3 Comments
 
LVL 17

Accepted Solution

by:
akshah123 earned 2000 total points
ID: 11715908
I am not sure if this leads you to some solution or not, but following page shows you options as to view the logs that mysql keeps.

http://dev.mysql.com/doc/mysql/en/Log_Files.html

Plus, using commands such as
show processlist;
from time to time you can see what users are online and what queries are running.
0
 
LVL 12

Author Comment

by:Gregory Miller
ID: 11716433
Indirectly, your answer helped... I dug a little deeper and found this, which I has not noticed before. It solved the problem and is providing me a log file of all connections and queries... Thank you so much...

Note that if you use --log=/var/log/mysqld.log and the mysql user doesn't have privileges in that directory, you can work around this by:
(1) becoming root:
su
(2) changing to the target directory:
cd /var/log
(3) creating the log initially
touch mysqld.log
(4) allowing anyone to write to it:
chmod 777 mysqld.log
(5) restarting mysql

This solved a problem I was having where mysqld would not create the initial log file even with the proper command-line args, but wouldn't complain about it, either. It would just silently go on.


0
 
LVL 12

Author Comment

by:Gregory Miller
ID: 11716452
I actually set ownership to the process owner and did not chmod the file 777 and this also worked and is more secure
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question