QueryException SQLSTATE[HY000] [2002] 无法连接到“127.0.0.1”上的 MySQL 服务器 (110)当我将此项目放入另一台服务器时,它工作正常。服务器配置有问题吗?在database.php'default' => env('DB_CONNECTION', 'mysql'),'connections' => [ 'sqlite' => [ 'driver' => 'sqlite', 'database' => env('DB_DATABASE', database_path('database.sqlite')), 'prefix' => '', ], 'mysql' => [ 'driver' => 'mysql', 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '3306'), 'database' => 'projapati', 'username' => 'projapati', 'password' => 'AHt!j![(dl', 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', 'strict' => false, 'engine' => null, ], 'pgsql' => [ 'driver' => 'pgsql', 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '5432'), 'database' => env('DB_DATABASE', 'forge'), 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), 'charset' => 'utf8', 'prefix' => '', 'schema' => 'public', 'sslmode' => 'prefer', ],],我怎么解决这个问题?
1 回答
守着星空守着你
TA贡献1799条经验 获得超8个赞
改变这个
'host' => env('DB_HOST', '127.0.0.1'),
对此
'host' => env('DB_HOST', 'localhost'),
- 1 回答
- 0 关注
- 134 浏览
添加回答
举报
0/150
提交
取消