php - 连接被拒绝 SQL: select * from information_schema.tables where table_schema = firstdb and table_name = migrations and table_type = 'BASE TABLE
问题描述
我已经安装并打开了 XAMPP,这就是我访问 phpmyadmin 页面的方式。我在 phpmyadmin 中创建了一个名为“firstdb”的数据库。
我还在本地存储的 laravel 文件中创建了身份验证。我正在尝试使用 php artisan migrate 迁移表,但出现以下错误。
user@Andress-MacBook-Pro admin-panel % php artisan migrate
Illuminate\Database\QueryException
SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = firstdb and table_name = migrations and table_type = 'BASE TABLE')
at vendor/laravel/framework/src/Illuminate/Database/Connection.php:671
667| // If an exception occurs when attempting to run a query, we'll format the error
668| // message to include the bindings with SQL, which will make this exception a
669| // lot more helpful to the developer instead of just the database's errors.
670| catch (Exception $e) {
> 671| throw new QueryException(
672| $query, $this->prepareBindings($bindings), $e
673| );
674| }
675|
+37 vendor frames
38 artisan:37
Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
我到处找,请帮忙。
解决方案
它可能是您.env
文件中的错误 mysql 端口号。检查您的.env
文件并确保端口号与 mysql 正在使用的端口号匹配。
推荐阅读
- reactjs - React 中的 IFrame,zabbix
- arrays - 在函数 SwiftUI 中访问变量
- neo4j - 如何找到与给定节点共享至少 n 个节点的所有节点
- class - 使变量等于类中的 Arraylist 值(处理)
- javascript - 在 try 块中抛出异常后,catch 块不会立即执行
- c# - PDB文件未与exe和源代码配对
- ansible - 生成的 podman systemd 文件无法启用
- c# - 将泛型类型的属性列表传递给函数
- c++ - 从链接到另一个 dll 的 dll 使用我的 exe 时,访问冲突执行位置 0x0000
- kubernetes - 在同一台机器上运行两个 K3S 实例