laravel - 从 git 克隆后 Laravel 数据库名称不正确
问题描述
我使用 ssh 密钥从 git 克隆了我的项目,现在我的 env 文件已更改。无论我尝试什么工匠命令,它一直说我的数据库名称错误。
有人知道我应该填写什么吗?我忘记了上一个 env 文件中的数据库名称是什么。我失去了另一个项目。
SQLSTATE[HY000] [1049] Unknown database 'laravel' (SQL: select * from `permission`)
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▕
• Database name seems incorrect: You're using the default database name `laravel`. This database does not exist.
Edit the `.env` file and use the correct database name in the `DB_DATABASE` key.
这是我的环境文件的一部分:
PP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=root
解决方案
检查 config/database.php 连接一些开发人员编写他们的数据库配置
推荐阅读
- java - 当对象不是数组类型时如何迭代对象
- android - 南越口音文字转语音
- sql - SQL Server 2014 - 不同的表交互和 SUM
- c# - 使用来自不同实体的 viewModel 从表单保存输入
- javascript - 如何使用 MutationObserver 获取导致 DOM 突变的函数?
- angular - Angular:在 APP_INITIALIZER 中发送 http 请求之前加载配置文件
- java - 当 try 块中发生异常时从方法调用 catch 块
- c++ - 字符串成员不适用于由分隔符分隔的文件中的字符串
- azure - 如何在我的 Azure 订阅中查找所有预览服务?
- php - 如何在 Woocommerce 中获取和显示 BACS 帐户详细信息