Solved

Tracking mySQL Connection and Query Statements

Posted on 2004-08-03
3
893 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 500 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 11

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 11

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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

I use MySQL for many of my development projects in a Windows environment. To manage my databases (and perform queries) for years I used a tool called MySQL administrator.  This tool has since been replaced by MySQL Workbench. So I decided to m…
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

820 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