MSQL 5.1 Error establishing a database connection

saamxvr

Well-Known Member
Oct 30, 2010
90
0
56
Hello i have Intel(R) Xeon(TM) CPU 2.40GHz x4 , 2GB ram Dedicate server , im run 3 Wordpress site on it , my Server Load Averages is: 0.62 0.57 0.46

Mostly i getting this error (Error establishing a database connection )
I'm using MYSQL 5.1

this is before optimized my.cnf

[mysqld]
set-variable = max_connections=500
log-slow-queries
safe-show-database
this is after optimized my.cnf

[mysqld]
set-variable = max_connections=500
log-slow-queries
safe-show-database
query_cache_type=1
query_cache_size=128M
query_cache_limit=5M
sort_buffer_size=4M
read_rnd_buffer_size=512K
tmp_table_size=256M
max_heap_table_size=384M
thread_cache_size=32
key_buffer_size=128M
table_cache=1184
This is Tuner Result

[email protected] [~]# ./mysqltuner.pl

>> MySQLTuner 1.0.1 - Major Hayden <[email protected]>
>> Bug reports, feature requests, and downloads at MySQLTuner
>> Run with '--help' for additional options and output filtering

-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.1.51-log
[OK] Operating on 32-bit architecture with less than 2GB RAM

-------- Storage Engine Statistics -------------------------------------------
[--] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 747M (Tables: 1133)
[--] Data in InnoDB tables: 240K (Tables: 15)
[--] Data in MEMORY tables: 0B (Tables: 6)
[!!] Total fragmented tables: 22

-------- Performance Metrics -------------------------------------------------
[--] Up for: 3s (30 q [10.000 qps], 6 conn, TX: 132K, RX: 3K)
[--] Reads / Writes: 80% / 20%
[--] Total buffers: 522.0M global + 4.9M per thread (500 max threads)
[!!] Allocating > 2GB RAM on 32-bit systems can cause system instability
[!!] Maximum possible memory usage: 2.9G (147% of installed RAM)
[OK] Slow queries: 0% (0/30)
[OK] Highest usage of available connections: 0% (1/500)
[OK] Key buffer size / total MyISAM indexes: 128.0M/126.0M
[!!] Key buffer hit rate: 57.1% (49 cached / 21 reads)
[!!] Query cache efficiency: 0.0% (0 cached / 17 selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 1 sorts)
[OK] Temporary tables created on disk: 0% (0 on disk / 2 total)
[OK] Thread cache hit rate: 83% (1 created / 6 connections)
[OK] Table cache hit rate: 68% (11 open / 16 opened)
[OK] Open file limit used: 0% (23/2K)
[OK] Table locks acquired immediately: 100% (25 immediate / 25 locks)
[OK] InnoDB data size / buffer pool: 240.0K/8.0M

-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
MySQL started within last 24 hours - recommendations may be inaccurate
Variables to adjust:
*** MySQL's maximum memory usage is dangerously high ***
*** Add RAM before increasing MySQL buffer variables ***
query_cache_limit (> 5M, or use smaller result sets)
 

GaryT

Well-Known Member
May 19, 2010
320
3
68
Variables to adjust:
*** MySQL's maximum memory usage is dangerously high ***
*** Add RAM before increasing MySQL buffer variables ***
query_cache_limit (> 5M, or use smaller result sets)
*** MySQL's maximum memory usage is dangerously high ***
*** Add RAM before increasing MySQL buffer variables ***


max_connections=500

Put this to max_connections=100 - why do you need 500 ? Your not running ebay are you ?

query_cache_limit=5M
This means make it higher.

so now your my.cnf should look like:

[mysqld]
max_connections=100
log-slow-queries
safe-show-database
query_cache_type=1
query_cache_size=128M
query_cache_limit=6M
sort_buffer_size=4M
read_rnd_buffer_size=512K
tmp_table_size=256M
max_heap_table_size=384M
thread_cache_size=32
key_buffer_size=128M
table_cache=1184
 

saamxvr

Well-Known Member
Oct 30, 2010
90
0
56
Yes i will add this Thanks lot .!!!

one more question why MSQL server restarting auto ? i was use 5.0 , now im use 5.1 , i never face this problem on 5.0 , plz can you give some more info about that ? my server load just fine , only thing DB error .