Laravel 5.4.28给出“SQLSTATE [HY000] [2002]操作超时”

时间:2017-07-27 18:35:34

标签: php mysql laravel

我收到错误

  

SQLSTATE [HY000] [2002]操作超时(SQL:select * from users in where 1)

从我尝试发送到我的数据库的任何查询。

运行php artisan migrate从命令行运行完全正常,显示我的设置正确!怎么回事?!

.ENV:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=vehiclexray
DB_USERNAME=root
DB_PASSWORD=kzurxsxz1

database.php中:

'mysql' => [
    'driver' => 'mysql',
    'host' => env('DB_HOST', '127.0.0.1'),
    'port' => env('DB_PORT', '3306'),
    'database' => env('DB_DATABASE', 'database'),
    'username' => env('DB_USERNAME', 'root'),
    'password' => env('DB_PASSWORD', 'password'),
    'unix_socket' => env('DB_SOCKET', ''),
    'charset' => 'utf8mb4',
    'collation' => 'utf8mb4_unicode_ci',
     'prefix' => '',
     'strict' => true,
     'engine' => 
]

0 个答案:

没有答案