Solved

Tracking mySQL Connection and Query Statements

Posted on 2004-08-03
3
885 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:Technodweeb
  • 2
3 Comments
 
LVL 17

Accepted Solution

by:
akshah123 earned 500 total points
Comment Utility
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:Technodweeb
Comment Utility
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:Technodweeb
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
I have been using r1soft Continuous Data Protection (http://www.r1soft.com/linux-cdp/) for many years now with the mySQL Addon and wanted to share a trick I have used several times. For those of us that don't have the luxury of using all transact…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now