2016-11-11 87 views
0

我正在通過laravel實現一個網站。有一個問題,有時它顯示一些錯誤already has more than 'max_user_connections' active connections如何解決這個問題? enter image description here已經有超過'max_user_connections'活動連接

+0

集/ database.php''PDO :: ATTR_PERSISTENT'到'FALSE' – Xorifelse

+0

感謝reply.i上午檢查@Xorifelse –

+0

找不到類似於'PDO :: ATTR_PERSISTENT' .iam使用laravel 5.2 –

回答

0

你可以通過PDO選項連接(它沒有很好的記載,但代碼不會說謊:https://github.com/laravel/framework/blob/5.2/src/Illuminate/Database/Connectors/Connector.php#L33)在應用/config/database.php是這樣的:在'應用程序/配置

... 

'connections' => [ 
     ... 

     'mysql' => [ 
      'driver' => 'mysql', 
      'host'  => env('DB_HOST', 'localhost'), 
      'database' => env('DB_DATABASE', 'forge'), 
      'username' => env('DB_USERNAME', 'forge'), 
      'password' => env('DB_PASSWORD', ''), 
      'charset' => 'utf8', 
      'collation' => 'utf8_unicode_ci', 
      'prefix' => '', 
      'strict' => false, 
      'engine' => null, 
      'dump_command_path' => '/opt/mysql/bin', 
      'options' => [ 
       PDO::ATTR_PERSISTENT => false //@todo 
      ] 
     ], 

     ... 
+0

一些更深入presisten連接:「PHP持久連接是否邪惡? https://www.percona.com/blog/2006/11/12/are-php-persistent-connections-evil/ – Isinlor

相關問題