mysql - 如何修复 Laravel 8 - “SQLSTATE[HY000] [1049] 未知数据库”
问题描述
我正在尝试运行以下命令:
php artisan migrate
当我这样做时,我收到以下错误:
Illuminate\Database\QueryException
SQLSTATE[HY000] [1049] Unknown database 'verified_db' (SQL: select * from information_schema.tables where table_schema = verified_db and table_name = migrations and table_type = 'BASE TABLE')
at C:\Users\richa\Desktop\back-office\vendor\laravel\framework\src\Illuminate\Database\Connection.php:692
688▕ // If an exception occurs when attempting to run a query, we'll format the error
689▕ // message to include the bindings with SQL, which will make this exception a
690▕ // lot more helpful to the developer instead of just the database's errors.
691▕ catch (Exception $e) {
➜ 692▕ throw new QueryException(
693▕ $query, $this->prepareBindings($bindings), $e
694▕ );
695▕ }
696▕ }
1 C:\Users\richa\Desktop\back-office\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
PDOException::("SQLSTATE[HY000] [1049] Unknown database 'verified_db'")
2 C:\Users\richa\Desktop\back-office\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
PDO::__construct()
我已经使用我的数据库凭据配置了 .env 文件。我希望有人可以帮助解决这个问题。
解决方案
在 MySQL Workbench *在连接的服务器中创建一个新模式 ~set [Schema Name] = [DB_DATABASE]='your name' 运行命令:php artisan migrate
在 phpMyAdmin *create a Database ~set [Database Name] = [DB_DATABASE]='your name' 运行命令:php artisan migrate
推荐阅读
- latex - 用 Tikz 连接节点而不跨越其他块
- android - Gradle 编译选项可以自动影响多模块吗?(dexOptions,aaptOptions,lintOptions)
- amazon-web-services - Terraform AWS subnet_id 列表被视为 ec2 实例的单值字符串
- python - pandas - 读取出现在 excel 中的 excel 值
- xml - SOAP 请求中的传递日期
- python - Python - ZipFile 获取创建日期
- swift - Swift - 将 X 数据数组分配给其部分
- google-calendar-api - GCalendar API - 按 ID 排除事件?
- java - 如何从房间数据库中同步查询数据?
- audio - 在 Twilio 中接收 whatsapp 语音消息