我正在学习 Laravel 8,而且我是初学者。
我尝试通过 Sail 安装它以利用 Docker。
终端:
curl -s "https://laravel.build/learnlaravel" | bash
cd learnlaravel
./vendor/bin/sail up
现在转到 localhost,我看到 Laravel 欢迎页面,一切正常。
if I do:
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 文件的凭据创建和配置它?
感谢您的理解和支持 :)
Try
./vendor/bin/sail artisan migrate
代替
php artisan migrate
Docs: https://laravel.com/docs/8.x/artisan#laravel-sail https://laravel.com/docs/8.x/artisan#laravel-sail
此外,您可以安装任何数据库管理器并使用此凭据连接到数据库以查看和配置它。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)