Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a VPS and I am hosting a game site on it. Recently my CPU went to 3000% and memory is going near full.

When I checked the processes I found this process eating the CPU:

Pid-1571 (Trace) (Kill) 
Owner-mysql 
Priority-0 
CPU %-52.7 
Memory %-4.4
Command:
/usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --log-error=/var/lib/mysql/domain.com.err --pid-file=/var/lib/mysql/domain.com.pid

What does this command do? Why is it running? How do I stop it?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

This is MySQL, a database engine. I guess your site utilizes a MySQL database and the SQL queries are not optimal or the engine is not properly tuned. Anyway you can't simply stop it because your site will stop too.

share|improve this answer
1  
is there is anyway to know what the SQL queries that eat up the cpu? –  alhoseany Sep 2 '11 at 7:22
    
Sure, you can enable a mysql slow query log: dev.mysql.com/doc/refman/5.1/en/slow-query-log.html. There is a tool to process and summarize this log in the Maatkit utils package: maatkit.org/doc/mk-query-digest.html –  Alex Sep 2 '11 at 7:25

Depending on distribution, try

service mysql stop

or

/etc/init.d/mysql* stop

Be warned. Shutting it down will put you site offline, as it is the database.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.