Server Error 'too many connections' PHP MySql



Sering kali kita mendapati error Too Many Connections. Error ini terjadi karena, semua koneksi yang disediakan sudah terpakai. Biasanya error ini sering muncul jika kita menggunakan shared hosting.

Jumlah koneksi yang disediakan di set oleh variabel max_connections pada settingan MySql. Angka default max_connection adalah 151. Angka ini kita bisa atur ke angka yang lebih tinggi. Jika memang kita menginginkan koneksi yang lebih banyak ke database MySql server.

Server Error in Application.

Too many connections

 Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: MySql.Data.MySqlClient.MySqlException: Too many connections

Source Error:


An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:



[MySqlException (0x80004005): Too many connections]
   MySql.Data.MySqlClient.MySqlStream.ReadPacket() +195
   MySql.Data.MySqlClient.NativeDriver.Open() +429
   MySql.Data.MySqlClient.Driver.Open() +22
   MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings) +220
   MySql.Data.MySqlClient.MySqlPool.GetPooledConnection() +287
   MySql.Data.MySqlClient.MySqlPool.TryToGetDriver() +93
   MySql.Data.MySqlClient.MySqlPool.GetConnection() +65
   MySql.Data.MySqlClient.MySqlConnection.Open() +332
   WebMatrix.Data.Database.EnsureConnectionOpen() +44
   WebMatrix.Data.<QueryInternal>d__0.MoveNext() +66
   System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source) +164
   WebMatrix.Data.Database.QuerySingle(String commandText, Object[] args) +103
   EMA._Default.GetId() in D:\My Documents\Visual Studio 2010\Projects\EMA\EMA\Default.aspx.vb:46
   EMA._Default.Page_Load(Object sender, EventArgs e) in D:\My Documents\Visual Studio 2010\Projects\EMA\EMA\Default.aspx.vb:15
   System.Web.UI.Control.OnLoad(EventArgs e) +92
   System.Web.UI.Control.LoadRecursive() +54
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772



Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18446              

Solusi:

  1. Set ulang angka pada variabel max_connections ke angka yang lebih tinggi dan restart MySql service
  2. Restart MySql service untuk menutup semua koneksi yang ada sebagai solusi sementara.

0 komentar:

Posting Komentar