laradock 里 执行 php artisan migrate 报错
Illuminate\Database\QueryException
SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known (SQL: select * from information_schema.tables where table_schema = huaxuechang and table_name = migrations and table_type = 'BASE TABLE')
at vendor/laravel/framework/src/Illuminate/Database/Connection.php:712
708▕ // If an exception occurs when attempting to run a query, we'll format the error
709▕ // message to include the bindings with SQL, which will make this exception a
710▕ // lot more helpful to the developer instead of just the database's errors.
711▕ catch (Exception $e) {
➜ 712▕ throw new QueryException(
713▕ $query, $this->prepareBindings($bindings), $e
714▕ );
715▕ }
716▕ }
+33 vendor frames
34 artisan:37
Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
我的 .env 配置如下:
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=abcabc
DB_USERNAME=root
DB_PASSWORD=root
后续备注:我根据这个帖子:laracasts.com/discuss/channels/lar...
修改成了 0.0.0.0 , 可以正常 php artisan migrate 了,但是对项目的正常操作就会提示:Illuminate\Database\QueryException
SQLSTATE[HY000] [2002] Connection refused (SQL: select * from
admin_userswhere
id= 2 limit 1)
推荐文章: