centos out of memory

I rent a CentOS service, and with no permission creat a swap, now I now I am slow open my site, slow access with putty. When I tried many times, finally see my root part with putty

Here is a list of system situation by top commond, I am not sure why my centos system caused out of memory? (2G memory used) And how to avoid out of memory?Any good way to release memory when it nearly out of? Thanks.

Tasks: 390 total,   1 running, 389 sleeping,   0 stopped,   0 zombie
Cpu(s): 11.8%us,  2.4%sy,  0.0%ni, 85.8%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   2097152k total,  2097152k used,        0k free,        0k buffers
Swap:        0k total,        0k used,        0k free,        0k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
18362 mysql     15   0  774m 307m 6532 S 99.8 15.0  177:06 mysqld
20047 root      18   0 29780  12m 6256 S  4.3  0.6   0:00.42 php
17644 root      18   0 33380  16m 6412 S  3.0  0.8   0:04.25 php
20168 root      16   0 31896  15m 6360 S  2.3  0.7   0:02.30 php
18219 root      18   0 32376  15m 6400 S  1.7  0.8   0:02.68 php
18394 root      18   0 32116  15m 6408 S  1.0  0.8   0:02.35 php
20097 root      15   0 33020  16m 6360 S  1.0  0.8   0:03.05 php
20159 root      15   0  2504 1244  812 R  0.7  0.1   0:00.48 top
17972 root      15   0 33368  16m 6404 S  0.3  0.8   0:02.46 php
19492 root      15   0 31860  15m 6408 S  0.3  0.7   0:01.92 php
    1 root      18   0  2156  664  576 S  0.0  0.0   0:26.77 init
 1215 root      15  -4  2260  652  436 S  0.0  0.0   0:00.00 udevd
 1303 root      22   0  3880 1424  796 S  0.0  0.1   0:00.00 crond
 1305 root      15   0 30780  13m 6116 S  0.0  0.7   0:10.62 php
 1573 root      25   0  3880 1424  796 S  0.0  0.1   0:00.00 crond
 1574 root      18   0 32152  15m 6360 S  0.0  0.7   0:11.36 php
 1585 root      25   0  2832  868  700 S  0.0  0.0   0:00.00 xinetd

EDIT:

stoped mysqld, sort RES from top

20190 root      18   0 38256 6400 S  21m  0.0  1.0   0:04.74 php
20189 root      15   0 37004 6408 S  20m  0.0  1.0   0:04.17 php
19827 root      15   0 36212 6400 S  19m  0.0  1.0   0:06.29 php
20047 root      15   0 35412 6408 S  18m  0.0  0.9   0:03.09 php
20211 root      15   0 34968 6408 S  18m  0.0  0.9   0:01.53 php
20213 root      18   0 34684 6724 S  18m  0.0  0.9   0:25.12 php
16258 root      18   0 33636 6408 S  17m  0.0  0.8   0:06.29 php
20177 root      18   0 33380 6408 S  16m  0.0  0.8   0:03.93 php
21969 root      18   0 33348 6400 S  16m  0.0  0.8   0:01.27 php
21813 root      18   0 33152 6408 S  16m  0.0  0.8   0:02.50 php
20227 root      15   0 33152 6404 S  16m  0.0  0.8   0:03.39 php
21876 root      18   0 33004 6404 S  16m  0.0  0.8   0:01.22 php
21747 root      15   0 32596 6732 S  16m  0.0  0.8   0:19.16 php
21762 root      15   0 32872 6404 S  16m  0.0  0.8   0:02.05 php
 7821 root      18   0 32920 6360 S  16m  0.0  0.8   0:03.27 php
13783 root      18   0 32920 6360 S  16m  0.0  0.8   0:03.37 php
20066 root      18   0 32984 6360 S  16m  0.0  0.8   0:02.66 php
15511 root      18   0 32916 6356 S  16m  0.0  0.8   0:09.72 php
21771 root      18   0 32912 6400 S  16m  0.0  0.8   0:02.45 php

EDIT 2:

Tasks: 217 total,   1 running, 216 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.2%us,  0.0%sy,  0.0%ni, 99.7%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   2097152k total,   983132k used,  1114020k free,        0k buffers
Swap:        0k total,        0k used,        0k free,        0k cached

Solution 1:

This looks like mySQL ate up your memory. Lower the memory amount that mysql is allowed to use. The configuration file should be found at /etc/my.cnf.