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

前端 未结 10 2130
太阳男子
太阳男子 2020-12-05 11:19

I have put PushChatServer dir in htdocs folder and create database puschat try to run @\"http://localhost/PushChatServer/api/test/database.php\"

Then I got following

10条回答
  •  抹茶落季
    2020-12-05 11:35

    I'm not sure if this will work for you; but I use CakePHP, and I get this error whenever I forget to put the port number at the end of the 'host'.

    Hope this helps!

    Before

    'test' => [
            'className' => 'Cake\Database\Connection',
            'driver' => 'Cake\Database\Driver\Mysql',
            'persistent' => false,
            'host' => 'localhost',
            'username' => 'root',
            'password' => 'root',
            'database' => 'mylogin',
            'encoding' => 'utf8',
            'timezone' => 'UTC',
            'cacheMetadata' => true,
            'quoteIdentifiers' => false,
            'log' => false,
            //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
            'url' => env('DATABASE_TEST_URL', null),
        ]
    

    After

    'test' => [
            'className' => 'Cake\Database\Connection',
            'driver' => 'Cake\Database\Driver\Mysql',
            'persistent' => false,
            'host' => 'localhost:8080',
            'username' => 'root',
            'password' => 'root',
            'database' => 'mylogin',
            'encoding' => 'utf8',
            'timezone' => 'UTC',
            'cacheMetadata' => true,
            'quoteIdentifiers' => false,
            'log' => false,
            //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
            'url' => env('DATABASE_TEST_URL', null),
        ]
    

提交回复
热议问题