我正在通过laravel实现一个网站。有一个问题,有时它会显示一些错误already has more than 'max_user_connections' active connections
如何解决这个问题?
答案 0 :(得分:1)
还有另一个问题可能会解决您的问题
https://dba.stackexchange.com/questions/47131/how-to-get-rid-of-maximum-user-connections-error
答案 1 :(得分:0)
您可以将PDO选项传递给连接(没有详细记录,但代码不会谎言:https://github.com/laravel/framework/blob/5.2/src/Illuminate/Database/Connectors/Connector.php#L33)在 app / 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
]
],
...