【发布时间】:2021-03-23 19:53:08
【问题描述】:
您好,我刚刚尝试使用 Sai 安装 Laravel 8,但遇到了问题
我所做的是首先从 laravel 自己的页面运行 curl one-liner
curl -s https://laravel.build/sail-test | bash
一旦完成,我就按照它说的运行
cd sail-test && ./vendor/bin/sail up
一切正常,我可以连接到数据库,我可以在 http://localhost 上看到该站点但是在尝试迁移时出现以下错误:
$ sail artisan migrate:install
Illuminate\Database\QueryException
SQLSTATE[HY000] [2002] No route to host (SQL: create table `migrations` (`id` int unsigned not null auto_increment primary key, `migration` varchar(255) not null, `batch` int not null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')
at vendor/laravel/framework/src/Illuminate/Database/Connection.php:678
674▕ // If an exception occurs when attempting to run a query, we'll format the error
675▕ // message to include the bindings with SQL, which will make this exception a
676▕ // lot more helpful to the developer instead of just the database's errors.
677▕ catch (Exception $e) {
➜ 678▕ throw new QueryException(
679▕ $query, $this->prepareBindings($bindings), $e
680▕ );
681▕ }
682▕
+29 vendor frames
30 artisan:37
Illuminate\Foundation\Console\Kernel::handle()
我需要更改.env 文件中的任何内容还是需要先进行任何其他更改?
【问题讨论】:
-
您的 .env 文件中是否设置了密码?如果是这样,您可能需要在 docker-compose.yml 文件中将
MYSQL_ALLOW_EMPTY_PASSWORD设置为“否”。
标签: laravel-artisan laravel-8 laravel-sail