laravel 已经有超过 'max_user_connections' 个活动连接
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40545817/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
already has more than 'max_user_connections' active connections
提问by Pradyut Manna
回答by Fu Xu
there is another question may solve your problem
还有一个问题可以解决你的问题
https://dba.stackexchange.com/questions/47131/how-to-get-rid-of-maximum-user-connections-error
https://dba.stackexchange.com/questions/47131/how-to-get-rid-of-maximum-user-connections-error
回答by Kalmár Gábor
You can pass PDO options to the connection (it is not well documented, but the code won't lie: https://github.com/laravel/framework/blob/5.2/src/Illuminate/Database/Connectors/Connector.php#L33) in app/config/database.phplike this:
您可以将 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
]
],
...