【发布时间】:2021-07-29 23:26:42
【问题描述】:
我正在学习 Laravel 8,我是初学者。 我尝试通过 Sail 安装它以利用 Docker。 终端:
curl -s "https://laravel.build/learnlaravel" | bash
cd learnlaravel
./vendor/bin/sail up
现在转到 localhost 我看到 Laravel 欢迎页面,一切正常。
如果我这样做:
php artisan migrate
我收到此错误:
xlf @ MBP16-XLF learnlaravel% php artisan migrate
Illuminate \ Database \ QueryException
SQLSTATE [HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema = learnlaravel and table_name = migrations and table_type = 'BASE TABLE')
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▕
谁能用简单的话向我解释我做错了什么或我应该做什么? mySQL 数据库是否已经在 Docker 上?如何登录以使用 .env 文件的凭据创建和配置它? 感谢您的理解和支持:)
【问题讨论】: