2

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?

Bill the Lizard
  • 352
  • 1
  • 7
  • 15
alhoseany
  • 123
  • 3

2 Answers2

3

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.

Alex
  • 7,939
  • 6
  • 38
  • 52
  • 1
    is there is anyway to know what the SQL queries that eat up the cpu? – alhoseany Sep 02 '11 at 07:22
  • Sure, you can enable a mysql slow query log: http://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: http://www.maatkit.org/doc/mk-query-digest.html – Alex Sep 02 '11 at 07:25
1

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.

Sandra
  • 10,303
  • 38
  • 112
  • 165