Out of memory mysql was aborted I am using windows 2003 server, with 8G of RAM and MySQL was installed on It.

I am getting error as follows

out of memory.[ERROR] mysqld: Out of memory (Needed 523712 bytes).


The configuration which i have given are as 

max_connections=5000
query_cache_size=16M
table_cache=256
tmp_table_size=103M
thread_cache_size=12
myisam_max_sort_file_size=1M
myisam_sort_buffer_size=205M
key_buffer_size=175M
read_buffer_size=512k
read_rnd_buffer_size=1M
sort_buffer_size=2M
innodb_additional_mem_pool_size=12M
innodb_log_buffer_size=8024K
innodb_buffer_pool_size=1024M
innodb_log_file_size=170M
innodb_thread_concurrency=24


Can any one please tell me the solution.?why this is happening.
The main problem most of the time is buffer_pool_size, key_buffer_size , etc in My.cnf
This in depth post from @RolandoMySQLDBA should solve your problem:  

Why does MySQL say I&#39;m out of memory?