When I run top on my database server I get that mysqld has been running for 4:00.51 and it continues to go up.
I assume this means that one process with mysql has been running this long from other posts on here. Its not set to cumulative mode as best I can tell as the heading looks like it would change to CTIME if that be the case.
What I'm wondering is if this is normal for a site that makes a lot of individual connections using PHP. I shouldn't have any long running processes that would hold on to a mysql connection for this long, only seconds at most.
Am I incorrect to assume that this time relates to one connection/process running? I think usually I see it flash up and away on the TOP, not just stay there with this number increasing.
Best Answer
When you look at
top
and seemysqld
, there should only be onemysqld
per instance. Older versions of server-compiledmysqld
spawn many threads. I'll assume you are not using such.To see individual connections you could do one of two things
In mysql client, run
SHOW PROCESSLIST;
(Source of incoming connection in the third columnHost
)In the OS, run
netstat | grep -i mysql
netstat | grep 3306
For emphasis, you should only see one
mysqld
process per instance.If you want to double check the time value as seen in top, ask mysqld
If you have MySQL 5.1+, run this:
If you have MySQL 5.0, run this
This will give you the number of seconds mysqld has been running.
If you want to see the date and time mysqld started
MySQL 5.1+
MySQL 5.0
Give it a Try !!!