Basic question about mysql process running

  • susancbk
  • Proficient
  • Proficient
  • susancbk
  • Posts: 293
  • Loc: New York City

Post 3+ Months Ago

When I ssh into my server and run the 'top' command to see what processes are running it's showing this for mysql:


18089 mysql 18 0 286m 188m 5056 S 0 12.3 64:59.47 mysqld


All the other processes are only running for a few seconds here and there, why is mysql running for so long? I thought after any queries are done it's supposed to automatically close the connection?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9088
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

That is because mysql is its own daemon running in the background waiting for connections. The way I actually see what is going on with mysql is from your ssh shell to type in:

mysql

It will then bring up something like this:

Quote:
root@server1 [/]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3175230
Server version: 5.0.67-community-log MySQL Community Edition (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>


At that point I type in "show processlist" and something like this will happen:

Quote:
mysql> show processlist;
+---------+-------------+-----------+-------------------+---------+------+----------------+
| Id | User | Host | db | Command | Time | State | Info |
+---------+-------------+-----------+-------------------+---------+------+----------------+
| 3175230 | root | localhost | NULL | Query | 0 | NULL | show processlist |
| 3175389 | test_user | localhost | test_db | Sleep | 1 | | NULL |
| 3175390 | test_user | localhost | test_db | Sleep | 1 | | NULL |
| 3175392 | test_user | localhost | test_db | Sleep | 0 | | NULL |
| 3175393 | test_user | localhost | test_db | Query | 0 | Sorting result | SELECT u.username, u.username_clean, u.user_id, u.user_type, u.user_allow_viewonline, u.user_colour, |
| 3175394 | test_user | localhost | test_db | Sleep | 0 | | NULL |
+---------+-------------+-----------+-------------------+---------+------+----------------+
6 rows in set (0.00 sec)


Once done type quit; and hit enter and you can exit out of there. Anyway its normal what you are seeing with MySQL, same thing for our servers. There has to be a daemon sitting there waiting for incoming connections.
  • susancbk
  • Proficient
  • Proficient
  • susancbk
  • Posts: 293
  • Loc: New York City

Post 3+ Months Ago

That's what I was suspecting. Thanks for the extra tips!

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 19 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.