2013-10-03 34 views
0

我有一個共享的託管帳戶,我在那裏運行動態網站。我在數據庫記錄返回的某個時間面臨着以下問題。用戶已經有超過'max_user_connections'活動連接

Warning: mysql_connect() [function.mysql-connect]: User myuser already has more than 'max_user_connections' active connections in path/db.php on line 4 
Could not connect: User myuser already has more than 'max_user_connections' active connections 

我正在關閉像mysql_close($ con)在每個文件中執行查詢的所有連接;

是不是因爲這個?或者可能有其他問題? 我可以追蹤出我缺少mysql關閉連接的問題嗎?

有人可以幫我嗎?謝謝

+0

http://stackoverflow.com/questions/4079531/mysqli-error-user-already-has-more-than-max-user-connections-active-connectio –

回答

1

不要打開和關閉每個文件或每個查詢更糟糕的連接。創建一個類似於connection.php的文件,在該文件中放置mysql_connect語句,並在要使用它的地方使用require_once。 請勿使用mysql_close,因爲每次腳本結束時連接會自動關閉。

+0

這不是一個編程問題,只是數量的資源可用。而任何其他使用這個類的腳本都會有錯誤。 –

相關問題