laravel SQLSTATE[HY000] [2002] 没有这样的文件或目录 (SQL: select * from `sessions` where `id` =

Posted

技术标签:

【中文标题】laravel SQLSTATE[HY000] [2002] 没有这样的文件或目录 (SQL: select * from `sessions` where `id` =【英文标题】:laravel SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from `sessions` where `id` = 【发布时间】:2019-09-30 08:29:56 【问题描述】:

我已将工作代码上传到实时站点,没有进行任何更改。

但我收到了跟随错误。

SQLSTATE[HY000] [2002] 没有这样的文件或目录(SQL: select * from sessions 其中id = dgbEmZ9AufF9UD9GG8X7kkeUxLlppZ1Z37UHQbHd 限制 1)

会话表存在,但它是空的。

我使用的是 laravel 5.x 版本。

错误日志

[2019-05-13 11:08:31] local.ERROR: SQLSTATE[HY000] [2002] No such file or directory "exception":"[object] (Doctrine\\DBAL\\Driver\\PDOException(code: 2002): 
SQLSTATE[HY000] [2002] No such file or directory at /questionnaire/questionnaire/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:31, 
SQLSTATE[HY000] [2002] No such file or directory at /questionnaire/questionnaire/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27)
[stacktrace]
#0 /Database/Connectors/Connector.php(64): Doctrine\\DBAL\\Driver\\PDOConnection->__construct('mysql:host=loca...', 'root', 'root', Array)
#1 /Database/Connectors/Connector.php(43): Illuminate\\Database\\Connectors\\Connector->createPdoConnection('mysql:host=loca...', 'root', 'root', Array)
#2 /Database/Connectors/MySqlConnector.php(24): Illuminate\\Database\\Connectors\\Connector->createConnection('mysql:host=loca...', Array, Array)
#3 /Database/Connectors/ConnectionFactory.php(183): Illuminate\\Database\\Connectors\\MySqlConnector->connect(Array)
#4 [internal function]: Illuminate\\Database\\Connectors\\ConnectionFactory->Illuminate\\Database\\Connectors\\closure()
#5 /Database/Connection.php(915): call_user_func(Object(Closure))
#6 /Database/Connection.php(940): Illuminate\\Database\\Connection->getPdo()
#7 /Database/Connection.php(399): Illuminate\\Database\\Connection->getReadPdo()
#8 /Database/Connection.php(325): Illuminate\\Database\\Connection->getPdoForSelect(true)
#9 /Database/Connection.php(657): Illuminate\\Database\\Connection->Illuminate\\Database\\closure('select * from `...', Array)
#10 /Database/Connection.php(624): Illuminate\\Database\\Connection->runQueryCallback('select * from `...', Array, Object(Closure))
#11 /Database/Connection.php(333): Illuminate\\Database\\Connection->run('select * from `...', Array, Object(Closure))
#12 /Database/Query/Builder.php(1719): Illuminate\\Database\\Connection->select('select * from `...', Array, true)
#13 /Database/Query/Builder.php(1704): Illuminate\\Database\\Query\\Builder->runSelect()
#14 /Database/Concerns/BuildsQueries.php(77): Illuminate\\Database\\Query\\Builder->get(Array)
#15 /Database/Query/Builder.php(1674): Illuminate\\Database\\Query\\Builder->first(Array)
#16 /Session/DatabaseSessionHandler.php(91): Illuminate\\Database\\Query\\Builder->find('dgbEmZ9AufF9UD9...')
#17 /Session/Store.php(96): Illuminate\\Session\\DatabaseSessionHandler->read('dgbEmZ9AufF9UD9...')
#18 /Session/Store.php(86): Illuminate\\Session\\Store->readFromHandler()
#19 /Session/Store.php(70): Illuminate\\Session\\Store->loadSession()
#20 /Session/Middleware/StartSession.php(102): Illuminate\\Session\\Store->start()
#21 /Support/helpers.php(1038): Illuminate\\Session\\Middleware\\StartSession->Illuminate\\Session\\Middleware\\closure(Object(Illuminate\\Session\\Store))
#22 /Session/Middleware/StartSession.php(103): tap(Object(Illuminate\\Session\\Store), Object(Closure))
#23 /Session/Middleware/StartSession.php(57): Illuminate\\Session\\Middleware\\StartSession->startSession(Object(Illuminate\\Http\\Request))
#24 /Pipeline/Pipeline.php(149): Illuminate\\Session\\Middleware\\StartSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#25 /Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\closure(Object(Illuminate\\Http\\Request))
#26 /Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\closure(Object(Illuminate\\Http\\Request))
#27 /Pipeline/Pipeline.php(149): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#28 /Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\closure(Object(Illuminate\\Http\\Request))
#29 /Cookie/Middleware/EncryptCookies.php(66): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\closure(Object(Illuminate\\Http\\Request))
#30 /Pipeline/Pipeline.php(149): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#31 /Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\closure(Object(Illuminate\\Http\\Request))
#32 /Pipeline/Pipeline.php(102): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\closure(Object(Illuminate\\Http\\Request))
#33 /Routing/Router.php(660): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#34 /Routing/Router.php(635): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#35 /Routing/Router.php(601): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#36 /Routing/Router.php(590): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#37 /Foundation/Http/Kernel.php(176): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#38 /Routing/Pipeline.php(30): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\closure(Object(Illuminate\\Http\\Request))
#39 /questionnaire/questionnaire/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(65): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\closure(Object(Illuminate\\Http\\Request))
#40 /Pipeline/Pipeline.php(149): Barryvdh\\Debugbar\\Middleware\\InjectDebugbar->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#41 /Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\closure(Object(Illuminate\\Http\\Request))
#42 /questionnaire/questionnaire/vendor/fideloper/proxy/src/TrustProxies.php(56): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\closure(Object(Illuminate\\Http\\Request))
#43 /Pipeline/Pipeline.php(149): Fideloper\\Proxy\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#44 /Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\closure(Object(Illuminate\\Http\\Request))
#45 /Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\closure(Object(Illuminate\\Http\\Request))
#46 /Pipeline/Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#47 /Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\closure(Object(Illuminate\\Http\\Request))
#48 /Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\closure(Object(Illuminate\\Http\\Request))
#49 /Pipeline/Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#50 /Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\closure(Object(Illuminate\\Http\\Request))
#51 /Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\closure(Object(Illuminate\\Http\\Request))
#52 /Pipeline/Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#53 /Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\closure(Object(Illuminate\\Http\\Request))
#54 /Foundation/Http/Middleware/CheckForMaintenanceMode.php(46): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\closure(Object(Illuminate\\Http\\Request))
#55 /Pipeline/Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#56 /Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\closure(Object(Illuminate\\Http\\Request))
#57 /Pipeline/Pipeline.php(102): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\closure(Object(Illuminate\\Http\\Request))
#58 /Foundation/Http/Kernel.php(151): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#59 /Foundation/Http/Kernel.php(116): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#60 /questionnaire/questionnaire/public/index.php(53): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#61 main
" 
[2019-05-13 11:08:31] local.ERROR: SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from `sessions` where `id` = dgbEmZ9AufF9UD9GG8X7kkeUxLlppZ1Z37UHQbHd limit 1) "exception":"[object] (Illuminate\\Database\\QueryException(code: 2002): SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from `sessions` where `id` = dgbEmZ9AufF9UD9GG8X7kkeUxLlppZ1Z37UHQbHd limit 1) at /Database/Connection.php:664, Doctrine\\DBAL\\Driver\\PDOException(code: 2002): SQLSTATE[HY000] [2002] No such file or directory at /questionnaire/questionnaire/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:31, PDOException(code: 2002): SQLSTATE[HY000] [2002] No such file or directory at /questionnaire/questionnaire/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27)
[stacktrace]
#0 /Database/Connection.php(624): Illuminate\\Database\\Connection->runQueryCallback('select * from `...', Array, Object(Closure))
#1 /Database/Connection.php(333): Illuminate\\Database\\Connection->run('select * from `...', Array, Object(Closure))
#2 /Database/Query/Builder.php(1719): Illuminate\\Database\\Connection->select('select * from `...', Array, true)
#3 /Database/Query/Builder.php(1704): Illuminate\\Database\\Query\\Builder->runSelect()
#4 /Database/Concerns/BuildsQueries.php(77): Illuminate\\Database\\Query\\Builder->get(Array)
#5 /Database/Query/Builder.php(1674): Illuminate\\Database\\Query\\Builder->first(Array)
#6 /Session/DatabaseSessionHandler.php(91): Illuminate\\Database\\Query\\Builder->find('dgbEmZ9AufF9UD9...')
#7 /Session/Store.php(96): Illuminate\\Session\\DatabaseSessionHandler->read('dgbEmZ9AufF9UD9...')
#8 /Session/Store.php(86): Illuminate\\Session\\Store->readFromHandler()
#9 /Session/Store.php(70): Illuminate\\Session\\Store->loadSession()
#10 /Session/Middleware/StartSession.php(102): Illuminate\\Session\\Store->start()
#11 /Support/helpers.php(1038): Illuminate\\Session\\Middleware\\StartSession->Illuminate\\Session\\Middleware\\closure(Object(Illuminate\\Session\\Store))
#12 /Session/Middleware/StartSession.php(103): tap(Object(Illuminate\\Session\\Store), Object(Closure))
#13 /Session/Middleware/StartSession.php(57): Illuminate\\Session\\Middleware\\StartSession->startSession(Object(Illuminate\\Http\\Request))
#14 /Pipeline/Pipeline.php(149): Illuminate\\Session\\Middleware\\StartSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#15 /Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\closure(Object(Illuminate\\Http\\Request))
#16 /Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\closure(Object(Illuminate\\Http\\Request))
#17 /Pipeline/Pipeline.php(149): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#18 /Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\closure(Object(Illuminate\\Http\\Request))
#19 /Cookie/Middleware/EncryptCookies.php(66): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\closure(Object(Illuminate\\Http\\Request))
#20 /Pipeline/Pipeline.php(149): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#21 /Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\closure(Object(Illuminate\\Http\\Request))
#22 /Pipeline/Pipeline.php(102): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\closure(Object(Illuminate\\Http\\Request))
#23 /Routing/Router.php(660): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#24 /Routing/Router.php(635): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#25 /Routing/Router.php(601): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#26 /Routing/Router.php(590): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#27 /Foundation/Http/Kernel.php(176): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#28 /Routing/Pipeline.php(30): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\closure(Object(Illuminate\\Http\\Request))
#29 /questionnaire/questionnaire/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(65): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\closure(Object(Illuminate\\Http\\Request))
#30 /Pipeline/Pipeline.php(149): Barryvdh\\Debugbar\\Middleware\\InjectDebugbar->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#31 /Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\closure(Object(Illuminate\\Http\\Request))
#32 /questionnaire/questionnaire/vendor/fideloper/proxy/src/TrustProxies.php(56): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\closure(Object(Illuminate\\Http\\Request))
#33 /Pipeline/Pipeline.php(149): Fideloper\\Proxy\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#34 /Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\closure(Object(Illuminate\\Http\\Request))
#35 /Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\closure(Object(Illuminate\\Http\\Request))
#36 /Pipeline/Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#37 /Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\closure(Object(Illuminate\\Http\\Request))
#38 /Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\closure(Object(Illuminate\\Http\\Request))
#39 /Pipeline/Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#40 /Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\closure(Object(Illuminate\\Http\\Request))
#41 /Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\closure(Object(Illuminate\\Http\\Request))
#42 /Pipeline/Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#43 /Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\closure(Object(Illuminate\\Http\\Request))
#44 /Foundation/Http/Middleware/CheckForMaintenanceMode.php(46): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\closure(Object(Illuminate\\Http\\Request))
#45 /Pipeline/Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#46 /Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\closure(Object(Illuminate\\Http\\Request))
#47 /Pipeline/Pipeline.php(102): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\closure(Object(Illuminate\\Http\\Request))
#48 /Foundation/Http/Kernel.php(151): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#49 /Foundation/Http/Kernel.php(116): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#50 /questionnaire/questionnaire/public/index.php(53): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#51 main
" 
[2019-05-13 11:08:31] local.ERROR: SQLSTATE[HY000] [2002] No such file or directory "exception":"[object] (Doctrine\\DBAL\\Driver\\PDOException(code: 2002): SQLSTATE[HY000] [2002] No such file or directory at /questionnaire/questionnaire/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:31, PDOException(code: 2002): SQLSTATE[HY000] [2002] No such file or directory at /questionnaire/questionnaire/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27)
[stacktrace]
#0 /Database/Connectors/Connector.php(64): Doctrine\\DBAL\\Driver\\PDOConnection->__construct('mysql:host=loca...', 'root', 'root', Array)
#1 /Database/Connectors/Connector.php(43): Illuminate\\Database\\Connectors\\Connector->createPdoConnection('mysql:host=loca...', 'root', 'root', Array)
#2 /Database/Connectors/MySqlConnector.php(24): Illuminate\\Database\\Connectors\\Connector->createConnection('mysql:host=loca...', Array, Array)
#3 /Database/Connectors/ConnectionFactory.php(183): Illuminate\\Database\\Connectors\\MySqlConnector->connect(Array)
#4 [internal function]: Illuminate\\Database\\Connectors\\ConnectionFactory->Illuminate\\Database\\Connectors\\closure()
#5 /Database/Connection.php(915): call_user_func(Object(Closure))
#6 /Database/Connection.php(940): Illuminate\\Database\\Connection->getPdo()
#7 /Database/Connection.php(399): Illuminate\\Database\\Connection->getReadPdo()
#8 /Database/Connection.php(325): Illuminate\\Database\\Connection->getPdoForSelect(true)
#9 /Database/Connection.php(657): Illuminate\\Database\\Connection->Illuminate\\Database\\closure('select * from `...', Array)
#10 /Database/Connection.php(624): Illuminate\\Database\\Connection->runQueryCallback('select * from `...', Array, Object(Closure))
#11 /Database/Connection.php(333): Illuminate\\Database\\Connection->run('select * from `...', Array, Object(Closure))
#12 /Database/Query/Builder.php(1719): Illuminate\\Database\\Connection->select('select * from `...', Array, true)
#13 /Database/Query/Builder.php(1704): Illuminate\\Database\\Query\\Builder->runSelect()
#14 /Database/Concerns/BuildsQueries.php(77): Illuminate\\Database\\Query\\Builder->get(Array)
#15 /Database/Query/Builder.php(1674): Illuminate\\Database\\Query\\Builder->first(Array)
#16 /Session/DatabaseSessionHandler.php(91): Illuminate\\Database\\Query\\Builder->find('dgbEmZ9AufF9UD9...')
#17 /Session/Store.php(96): Illuminate\\Session\\DatabaseSessionHandler->read('dgbEmZ9AufF9UD9...')
#18 /Session/Store.php(86): Illuminate\\Session\\Store->readFromHandler()
#19 /Session/Store.php(70): Illuminate\\Session\\Store->loadSession()
#20 /Support/Manager.php(138): Illuminate\\Session\\Store->start()
#21 /questionnaire/questionnaire/vendor/barryvdh/laravel-debugbar/src/SymfonyHttpDriver.php(42): Illuminate\\Support\\Manager->__call('start', Array)
#22 /questionnaire/questionnaire/vendor/maximebf/debugbar/src/DebugBar/DebugBar.php(446): Barryvdh\\Debugbar\\SymfonyHttpDriver->isSessionStarted()
#23 /questionnaire/questionnaire/vendor/maximebf/debugbar/src/DebugBar/DebugBar.php(359): DebugBar\\DebugBar->initStackSession()
#24 /questionnaire/questionnaire/vendor/maximebf/debugbar/src/DebugBar/javascriptRenderer.php(984): DebugBar\\DebugBar->hasStackedData()
#25 /questionnaire/questionnaire/vendor/barryvdh/laravel-debugbar/src/LaravelDebugbar.php(850): DebugBar\\JavascriptRenderer->render()
#26 /questionnaire/questionnaire/vendor/barryvdh/laravel-debugbar/src/LaravelDebugbar.php(735): Barryvdh\\Debugbar\\LaravelDebugbar->injectDebugbar(Object(Illuminate\\Http\\Response))
#27 /questionnaire/questionnaire/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(74): Barryvdh\\Debugbar\\LaravelDebugbar->modifyResponse(Object(Illuminate\\Http\\Request), Object(Illuminate\\Http\\Response))
#28 /Pipeline/Pipeline.php(149): Barryvdh\\Debugbar\\Middleware\\InjectDebugbar->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#29 /Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\closure(Object(Illuminate\\Http\\Request))
#30 /questionnaire/questionnaire/vendor/fideloper/proxy/src/TrustProxies.php(56): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\closure(Object(Illuminate\\Http\\Request))
#31 /Pipeline/Pipeline.php(149): Fideloper\\Proxy\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#32 /Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\closure(Object(Illuminate\\Http\\Request))
#33 /Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\closure(Object(Illuminate\\Http\\Request))
#34 /Pipeline/Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#35 /Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\closure(Object(Illuminate\\Http\\Request))
#36 /Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\closure(Object(Illuminate\\Http\\Request))
#37 /Pipeline/Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#38 /Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\closure(Object(Illuminate\\Http\\Request))
#39 /Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\closure(Object(Illuminate\\Http\\Request))
#40 /Pipeline/Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#41 /Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\closure(Object(Illuminate\\Http\\Request))
#42 /Foundation/Http/Middleware/CheckForMaintenanceMode.php(46): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\closure(Object(Illuminate\\Http\\Request))
#43 /Pipeline/Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#44 /Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\closure(Object(Illuminate\\Http\\Request))
#45 /Pipeline/Pipeline.php(102): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\closure(Object(Illuminate\\Http\\Request))
#46 /Foundation/Http/Kernel.php(151): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#47 /Foundation/Http/Kernel.php(116): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#48 /questionnaire/questionnaire/public/index.php(53): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#49 main
" 
[2019-05-13 11:08:31] local.ERROR: Debugbar exception: SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from `sessions` where `id` = dgbEmZ9AufF9UD9GG8X7kkeUxLlppZ1Z37UHQbHd limit 1)  
[2019-05-13 11:08:31] local.ERROR: SQLSTATE[HY000] [2002] No such file or directory "exception":"[object] (Doctrine\\DBAL\\Driver\\PDOException(code: 2002): SQLSTATE[HY000] [2002] No such file or directory at /questionnaire/questionnaire/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:31, PDOException(code: 2002): SQLSTATE[HY000] [2002] No such file or directory at /questionnaire/questionnaire/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27)
[stacktrace]
#0 /Database/Connectors/Connector.php(64): Doctrine\\DBAL\\Driver\\PDOConnection->__construct('mysql:host=loca...', 'root', 'root', Array)
#1 /Database/Connectors/Connector.php(43): Illuminate\\Database\\Connectors\\Connector->createPdoConnection('mysql:host=loca...', 'root', 'root', Array)
#2 /Database/Connectors/MySqlConnector.php(24): Illuminate\\Database\\Connectors\\Connector->createConnection('mysql:host=loca...', Array, Array)
#3 /Database/Connectors/ConnectionFactory.php(183): Illuminate\\Database\\Connectors\\MySqlConnector->connect(Array)
#4 [internal function]: Illuminate\\Database\\Connectors\\ConnectionFactory->Illuminate\\Database\\Connectors\\closure()
#5 /Database/Connection.php(915): call_user_func(Object(Closure))
#6 /Database/Connection.php(940): Illuminate\\Database\\Connection->getPdo()
#7 /Database/Connection.php(399): Illuminate\\Database\\Connection->getReadPdo()
#8 /Database/Connection.php(325): Illuminate\\Database\\Connection->getPdoForSelect(true)
#9 /Database/Connection.php(657): Illuminate\\Database\\Connection->Illuminate\\Database\\closure('select * from `...', Array)
#10 /Database/Connection.php(624): Illuminate\\Database\\Connection->runQueryCallback('select * from `...', Array, Object(Closure))
#11 /Database/Connection.php(333): Illuminate\\Database\\Connection->run('select * from `...', Array, Object(Closure))
#12 /Database/Query/Builder.php(1719): Illuminate\\Database\\Connection->select('select * from `...', Array, true)
#13 /Database/Query/Builder.php(1704): Illuminate\\Database\\Query\\Builder->runSelect()
#14 /Database/Concerns/BuildsQueries.php(77): Illuminate\\Database\\Query\\Builder->get(Array)
#15 /Database/Query/Builder.php(1674): Illuminate\\Database\\Query\\Builder->first(Array)
#16 /Session/DatabaseSessionHandler.php(91): Illuminate\\Database\\Query\\Builder->find('dgbEmZ9AufF9UD9...')
#17 /Session/DatabaseSessionHandler.php(128): Illuminate\\Session\\DatabaseSessionHandler->read('dgbEmZ9AufF9UD9...')
#18 /Session/Store.php(128): Illuminate\\Session\\DatabaseSessionHandler->write('dgbEmZ9AufF9UD9...', 'a:1:s:6:\"_flas...')
#19 /Session/Middleware/StartSession.php(87): Illuminate\\Session\\Store->save()
#20 /Foundation/Http/Kernel.php(218): Illuminate\\Session\\Middleware\\StartSession->terminate(Object(Illuminate\\Http\\Request), Object(Illuminate\\Http\\Response))
#21 /Foundation/Http/Kernel.php(189): Illuminate\\Foundation\\Http\\Kernel->terminateMiddleware(Object(Illuminate\\Http\\Request), Object(Illuminate\\Http\\Response))
#22 /questionnaire/questionnaire/public/index.php(58): Illuminate\\Foundation\\Http\\Kernel->terminate(Object(Illuminate\\Http\\Request), Object(Illuminate\\Http\\Response))
#23 main
" 
[2019-05-13 11:08:31] local.ERROR: SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from `sessions` where `id` = dgbEmZ9AufF9UD9GG8X7kkeUxLlppZ1Z37UHQbHd limit 1) "exception":"[object] (Illuminate\\Database\\QueryException(code: 2002): SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from `sessions` where `id` = dgbEmZ9AufF9UD9GG8X7kkeUxLlppZ1Z37UHQbHd limit 1) at /Database/Connection.php:664, Doctrine\\DBAL\\Driver\\PDOException(code: 2002): SQLSTATE[HY000] [2002] No such file or directory at /questionnaire/questionnaire/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:31, PDOException(code: 2002): SQLSTATE[HY000] [2002] No such file or directory at /questionnaire/questionnaire/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27)
[stacktrace]
#0 /Database/Connection.php(624): Illuminate\\Database\\Connection->runQueryCallback('select * from `...', Array, Object(Closure))
#1 /Database/Connection.php(333): Illuminate\\Database\\Connection->run('select * from `...', Array, Object(Closure))
#2 /Database/Query/Builder.php(1719): Illuminate\\Database\\Connection->select('select * from `...', Array, true)
#3 /Database/Query/Builder.php(1704): Illuminate\\Database\\Query\\Builder->runSelect()
#4 /Database/Concerns/BuildsQueries.php(77): Illuminate\\Database\\Query\\Builder->get(Array)
#5 /Database/Query/Builder.php(1674): Illuminate\\Database\\Query\\Builder->first(Array)
#6 /Session/DatabaseSessionHandler.php(91): Illuminate\\Database\\Query\\Builder->find('dgbEmZ9AufF9UD9...')
#7 /Session/DatabaseSessionHandler.php(128): Illuminate\\Session\\DatabaseSessionHandler->read('dgbEmZ9AufF9UD9...')
#8 /Session/Store.php(128): Illuminate\\Session\\DatabaseSessionHandler->write('dgbEmZ9AufF9UD9...', 'a:1:s:6:\"_flas...')
#9 /Session/Middleware/StartSession.php(87): Illuminate\\Session\\Store-
" 

.env 文件

APP_NAME="xxxx"
APP_ENV=local
APP_LOG_LEVEL=error
APP_URL=http://doc-share.elevenology.com/public



BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
QUEUE_DRIVER=sync

REDIS_HOST=
REDIS_PASSWORD=null
REDIS_PORT=6379  

【问题讨论】:

请不要向我们展示代码图片。将代码作为文本粘贴到您的问题中 @RiggsFolly 好的,请查看错误日志。 这有帮助吗***.com/questions/20723803/… @RiggsFolly nope 为什么不呢?你没看懂答案吗?还是您已经尝试过的解决方案? 【参考方案1】:

最常见的解决方案是在 .env 文件中将 localhost 更改为 127.0.0.1

PDOException SQLSTATE[HY000] [2002] No such file or directory

"SQLSTATE[HY000] [2002] No such file or directory" error when migrating table in Laravel

【讨论】:

.env 文件中没有 127.0.0.1 彼得!解决方案是将localhost 更改为127.0.0.1 所以你在任何地方看到LOCALHOST !!!!!! Errrr,有趣的是,我可以在您的 .env 文件中看到 127.0.0.1 ????这不是我们所说的参数,但它足够正确 亲爱的@RiggsFolly 如果我将 REDIS_HOST=127.0.0.1 更改为 REDIS_HOST=localhost 彼得请注意!!!我已经说过这不是要更改的参数【参考方案2】:

确保你的 .env:

SESSION_DRIVER=file

【讨论】:

请在您的答案中添加一些解释,以便其他人可以从中学习

以上是关于laravel SQLSTATE[HY000] [2002] 没有这样的文件或目录 (SQL: select * from `sessions` where `id` =的主要内容,如果未能解决你的问题,请参考以下文章

Laravel 7 SQLSTATE [HY000] [2002] 连接被拒绝

Laravel 6.0 迁移 - SQLSTATE[HY000] [2002] 没有这样的文件或目录

SQLSTATE[HY000] [2002] 连接被拒绝 Laravel 5.8.35

SQLSTATE[HY000]:一般错误:在 Laravel 中迁移期间出现 1005

PHP + MYSQL + Laravel - “SQLSTATE [HY000] [2002] 连接被拒绝” [重复]

SQLSTATE [HY000] Laravel 8 中的外键约束格式错误