Web Hosting Talk







View Full Version : mySQL. Help needed!!!


Bullet
03-30-2002, 08:02 PM
hi there.

ok, here's a situation. server with virtual hosts. one of users is an as*hole and crashes the server from time to time with his glitchy scripts.

currently i can catch his glitchy script in a second..... just by using "top" + "mod_status"...... not a problem.

but what do i do with mySQL ??? :rolleyes:
"top" PIDs are not the same as mySQL PIDs... so i can't compare PIDs and cick him out..
"show processlist;" ain't shows CPU or RAM usage, so i can't get the username also if i got few processes running at any time.

so the question is... how to trace a user who crashes a server with glitchy mySQL processes???

PLEASE, HELP

Bullet
03-30-2002, 08:07 PM
one more thing..
if at the time of crashing i'm logged in i can catch him......
i want a solution to implement in some kind of script or C program..
what my program should use/log/trace etc.?

Shyne
03-30-2002, 08:13 PM
You can start mysql with logging options. You gotta start mysql with --log. After mysql crashes you can see what was the last request.

Bullet
03-30-2002, 09:16 PM
well, i want something different.
when i run "top" i see PID of mySQL process, its CPU & RAM usage. how do i get info about this mySQL process???? (user, DB name).

Bullet
03-30-2002, 09:18 PM
sometimes "top" shows mySQL process with 50% CPU usage. i want to know which user overloads mySQL that much...

Shyne
03-30-2002, 09:40 PM
There isn't really a direct way to do you. You'll have to dig through the logs to find the users. That's why if you start mysql with --log you can see what database is being used exsesive amount of time.

You can check the /proc filesystem for more information about the process.

/proc/PID_NUMBER_HERE

priyadi
03-31-2002, 10:31 AM
"mysqladmin processlist" will show you the currently running queries, it also shows you which user is executing it. Then you can guess which one is the resource hog. If you are not sure, you can try the queries by yourself. You can use "mysqladmin kill #" to kill the offending thread.