我在运行bake命令时遇到问题.我认为它与
mysql有关,但我没有在Stackoverflow上找到任何解决此错误的方法.
这是我的app.PHP:
原文链接:https://www.f2er.com/php/135610.html这是我的app.PHP:
'Datasources' => [ 'default' => [ 'className' => 'Cake\Database\Connection','driver' => 'Cake\Database\Driver\MysqL','persistent' => false,'host' => 'localhost',//'port' => 'nonstandard_port_number','username' => 'root','password' => 'root','database' => 'laboiterose','encoding' => 'utf8','timezone' => 'UTC','cache@R_403_338@data' => true,
请帮忙,我得到的错误是:
Exception: sqlSTATE[HY000] [2002] No such file or directory in [/Applications/MAMP/htdocs/my_db/vendor/cakePHP/cakePHP/src/Database/Driver/PDODriverTrait.PHP,line 48] 2015-06-19 14:35:48 Error: [PDOException] sqlSTATE[HY000] [2002] No such file or directory Stack Trace: 0 /Applications/MAMP/htdocs/my_db/vendor/cakePHP/cakePHP/src/Database/Driver/PDODriverTrait.PHP(48): PDO->__construct('MysqL:host=loca...','root',Array) 1 /Applications/MAMP/htdocs/my_db/vendor/cakePHP/cakePHP/src/Database/Driver/MysqL.PHP(89): Cake\Database\Driver\MysqL->_connect('MysqL:host=loca...',Array) 2 /Applications/MAMP/htdocs/my_db/vendor/cakePHP/cakePHP/src/Database/Schema/BaseSchema.PHP(46): Cake\Database\Driver\MysqL->connect() 3 /Applications/MAMP/htdocs/my_db/vendor/cakePHP/cakePHP/src/Database/Dialect/MysqLDialectTrait.PHP(62): Cake\Database\Schema\BaseSchema->__construct(Object(Cake\Database\Driver\MysqL)) 4 /Applications/MAMP/htdocs/my_db/vendor/cakePHP/cakePHP/src/Database/Schema/Collection.PHP(52): Cake\Database\Driver\MysqL->schemaDialect() 5 /Applications/MAMP/htdocs/my_db/vendor/cakePHP/cakePHP/src/Database/Schema/CachedCollection.PHP(44): Cake\Database\Schema\Collection->__construct(Object(Cake\Database\Connection)) 6 /Applications/MAMP/htdocs/my_db/vendor/cakePHP/cakePHP/src/Database/Connection.PHP(319): Cake\Database\Schema\CachedCollection->__construct(Object(Cake\Database\Connection),true) 7 /Applications/MAMP/htdocs/my_db/vendor/cakePHP/bake/src/Shell/Task/ModelTask.PHP(806): Cake\Database\Connection->schemaCollection() 8 /Applications/MAMP/htdocs/my_db/vendor/cakePHP/bake/src/Shell/Task/ModelTask.PHP(782): Bake\Shell\Task\ModelTask->_getAllTables() 9 /Applications/MAMP/htdocs/my_db/vendor/cakePHP/bake/src/Shell/Task/ModelTask.PHP(186): Bake\Shell\Task\ModelTask->listAll() 10 /Applications/MAMP/htdocs/my_db/vendor/cakePHP/bake/src/Shell/Task/ModelTask.PHP(109): Bake\Shell\Task\ModelTask->getAssociations(Object(Cake\ORM\Table)) 11 /Applications/MAMP/htdocs/my_db/vendor/cakePHP/bake/src/Shell/Task/ModelTask.PHP(95): Bake\Shell\Task\ModelTask->bake('Users') 12 /Applications/MAMP/htdocs/my_db/vendor/cakePHP/bake/src/Shell/BakeShell.PHP(241): Bake\Shell\Task\ModelTask->main('Users') 13 [internal function]: Bake\Shell\BakeShell->all('users') 14 /Applications/MAMP/htdocs/my_db/vendor/cakePHP/cakePHP/src/Console/Shell.PHP(380): call_user_func_array(Array,Array) 15 /Applications/MAMP/htdocs/my_db/vendor/cakePHP/cakePHP/src/Console/ShellDispatcher.PHP(204): Cake\Console\Shell->runCommand(Array,true) 16 /Applications/MAMP/htdocs/my_db/vendor/cakePHP/cakePHP/src/Console/ShellDispatcher.PHP(175): Cake\Console\ShellDispatcher->_dispatch() 17 /Applications/MAMP/htdocs/my_db/vendor/cakePHP/cakePHP/src/Console/ShellDispatcher.PHP(126): Cake\Console\ShellDispatcher->dispatch() 18 /Applications/MAMP/htdocs/my_db/bin/cake.PHP(33): Cake\Console\ShellDispatcher::run(Array) 19 {main}