title: cakephp bake SQLSTATE[HY000] [2002] No such file or directory
body: <p>I followed the CakePHP tutorial and till now everything worked fine(newly added articles are shown in the db). But now that I tried to &quot;bin/cake bake model users&quot; I get the following error message: SQLSTATE[HY000] [2002] No such file or directory in [/opt/lampp/htdocs/MyApp/vendor/cakephp/cakephp/src/Database/Driver.php, line 92].
  I found this solution here: <a href="https://stackoverflow.com/questions/30941506/sqlstate-hy000-2002-while-running-bake-command">SQLSTATE HY000 2002 while running bake command</a> . But this does not seem to work on linux(Ubuntu). Any help would be appreciated.</p>
  <p>Full Error:</p>
  <pre><code>Exception: SQLSTATE[HY000] [2002] No such file or directory in [/opt/lampp/htdocs/MyApp/vendor/cakephp/cakephp/src/Database/Driver.php, line 92] 2018-12-06 11:28:03 Error: [PDOException] SQLSTATE[HY000] [2002] No such file or directory in /opt/lampp/htdocs/MyApp/vendor/cakephp/cakephp/src/Database/Driver.php on line 92 Stack Trace:
  #0 /opt/lampp/htdocs/MyApp/vendor/cakephp/cakephp/src/Database/Driver.php(92): PDO-&gt;__construct('mysql:host=loca...', 'root', '', Array)
  #1 /opt/lampp/htdocs/MyApp/vendor/cakephp/cakephp/src/Database/Driver/Mysql.php(106): Cake\Database\Driver-&gt;_connect('mysql:host=loca...', Array)
  #2 /opt/lampp/htdocs/MyApp/vendor/cakephp/cakephp/src/Database/Schema/BaseSchema.php(45): Cake\Database\Driver\Mysql-&gt;connect()
  #3 /opt/lampp/htdocs/MyApp/vendor/cakephp/cakephp/src/Database/Dialect/MysqlDialectTrait.php(63): Cake\Database\Schema\BaseSchema-&gt;__construct(Object(Cake\Database\Driver\Mysql))
  #4 /opt/lampp/htdocs/MyApp/vendor/cakephp/cakephp/src/Database/Schema/Collection.php(52): Cake\Database\Driver\Mysql-&gt;schemaDialect()
  #5 /opt/lampp/htdocs/MyApp/vendor/cakephp/cakephp/src/Database/Schema/CachedCollection.php(42): Cake\Database\Schema\Collection-&gt;__construct(Object(Cake\Database\Connection))
  #6 /opt/lampp/htdocs/MyApp/vendor/cakephp/cakephp/src/Database/Connection.php(391): Cake\Database\Schema\CachedCollection-&gt;__construct(Object(Cake\Database\Connection), true)
  #7 /opt/lampp/htdocs/MyApp/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(1052): Cake\Database\Connection-&gt;getSchemaCollection()
  #8 /opt/lampp/htdocs/MyApp/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(1006): Bake\Shell\Task\ModelTask-&gt;_getAllTables()
  #9 /opt/lampp/htdocs/MyApp/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(213): Bake\Shell\Task\ModelTask-&gt;listAll()
  #10 /opt/lampp/htdocs/MyApp/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(131): Bake\Shell\Task\ModelTask-&gt;getAssociations(Object(Cake\ORM\Table))
  #11 /opt/lampp/htdocs/MyApp/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(114): Bake\Shell\Task\ModelTask-&gt;getTableContext(Object(Cake\ORM\Table), 'users', 'Users')
  #12 /opt/lampp/htdocs/MyApp/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(101): Bake\Shell\Task\ModelTask-&gt;bake('Users')
  #13 /opt/lampp/htdocs/MyApp/vendor/cakephp/cakephp/src/Console/Shell.php(532): Bake\Shell\Task\ModelTask-&gt;main('users')
  #14 /opt/lampp/htdocs/MyApp/vendor/cakephp/cakephp/src/Console/Shell.php(525): Cake\Console\Shell-&gt;runCommand(Array, false, Array)
  #15 /opt/lampp/htdocs/MyApp/vendor/cakephp/cakephp/src/Console/CommandRunner.php(342): Cake\Console\Shell-&gt;runCommand(Array, true)
  #16 /opt/lampp/htdocs/MyApp/vendor/cakephp/cakephp/src/Console/CommandRunner.php(164): Cake\Console\CommandRunner-&gt;runShell(Object(Bake\Shell\BakeShell), Array)
  #17 /opt/lampp/htdocs/MyApp/bin/cake.php(12): Cake\Console\CommandRunner-&gt;run(
  </code></pre>
  <p>Array)</p>
  <h1>18 {main}</h1>